michelleqw
Programmer
Dear PHP users,
We make in the beginning of our code a variable constant $cnt. In function doing() we increment this variable but when we echo after de call function the variable the variable it is still zero!
code:
<?php
global $cnt ;
$cnt = 0 ;
doing() ;
echo "second $cnt<br>" ;
function doing()
{
$cnt++ ;
echo "first: $cnt<br>" ;
}
?>
Can someone tell us what we do wrong?
Nice regards,
Michelle.
We make in the beginning of our code a variable constant $cnt. In function doing() we increment this variable but when we echo after de call function the variable the variable it is still zero!
code:
<?php
global $cnt ;
$cnt = 0 ;
doing() ;
echo "second $cnt<br>" ;
function doing()
{
$cnt++ ;
echo "first: $cnt<br>" ;
}
?>
Can someone tell us what we do wrong?
Nice regards,
Michelle.