funeralcrasher (
funeralcrasher) wrote2008-06-23 10:33 am
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Stumped.
$num = 10;
function multiply()
{
$num = $num * 10;
}
multiply();
echo $num;
This prints "10" to the screen.
$num = $num * 10;
echo $num;
But this prints "0".
Why is that?
$num = 10;
function multiply()
{
$num = $num * 10;
}
multiply();
echo $num;
This prints "10" to the screen.
$num = $num * 10;
echo $num;
But this prints "0".
Why is that?
no subject
The problem remains, though - if $x * 2 = 0 (where x is not set), then why is the function returning a number instead of 0?
no subject