bigD Posted September 13, 2010 Share Posted September 13, 2010 I have a question on when PHP will allocate space in the code. Does it happen up front, or as the code executes? // some stuff if (some_conditional) { // something happens here and returns or exits } // we never get here $foo = array(); exit(0); In this example, does $foo get created? Link to comment https://forums.phpfreaks.com/topic/213330-question-on-php-variable-allocation/ Share on other sites More sharing options...
roopurt18 Posted September 14, 2010 Share Posted September 14, 2010 No. $foo is not created. <?php // some stuff if (some_conditional) { // something happens here and returns or exits echo var_export( isset( $foo ), true ) . PHP_EOL; exit(); } // we never get here $foo = array(); exit(0); ?> Link to comment https://forums.phpfreaks.com/topic/213330-question-on-php-variable-allocation/#findComment-1110779 Share on other sites More sharing options...
bigD Posted September 14, 2010 Author Share Posted September 14, 2010 No. $foo is not created. Thank you. Link to comment https://forums.phpfreaks.com/topic/213330-question-on-php-variable-allocation/#findComment-1110780 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.