I want to get a value of variable stored in another php scope
<?php
$count=3;
?>
<?php
echo($count); //does not print the value
?>
The 2 php scopes are in the same page.
I want to get a value of variable stored in another php scope
<?php
$count=3;
?>
<?php
echo($count); //does not print the value
?>
The 2 php scopes are in the same page.
In your case , it MUST show 3
Check this: http://php.net/manual/en/language.variables.scope.php
This link is full of examples like the one you have listed here.
http://php.net/manual/en/language.variables.scope.php
try using var_dump($varname)
you dont need to put the parenthesis (around the var)
<?php
$count=3;
echo $count; //will work
var_dump($count) //when in doubt, look at what is in the variable
?>