If yes is there any way to access a var defined in another PHP code snippet tag?
No, they don't. Separate <?php ?>
tags share the same variable scope. You can access any variable declared from any scope:
<?php $foo = 4; ?>
<?php echo $foo; /* will echo 4 */ ?>
The only scoping notion in PHP exists for functions or methods. To use a global variable in a function or a method, you must use the $GLOBALS
array, or a global $theVariableINeed;
declaration inside your function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With