What would the following code print to the browser? Why?
Top Questions
<?php
$num = 10;
function multiply(){
$num = $num * 10;
}
multiply();
echo $num;
?>Ans: 10 because,its a call by value.$num is static here. change the above code as
<?php
$num = 10;
function multiply(){
global $num ;
$num = $num * 10;
}
multiply();
echo $num;
?>
Post new comment