milesperhour1086 Posted March 23, 2006 Share Posted March 23, 2006 When creating a page in PHP, if I have the following:[code] php:$thisVar = $myArray[2]; .. .. .. .. $myArray = array(1,43,64,44); ?>[/code]Will thisVar be assigned 64 or will it be null because when we assigned thisVar, myArray did not exist yet?? I am trying to work with dreamWeaver templates and php and this is one of the things I need to figure out but I Don't have webspace to test it out on yet. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/5613-simple-variable-reference-question/ Share on other sites More sharing options...
redbullmarky Posted March 23, 2006 Share Posted March 23, 2006 [!--quoteo(post=357686:date=Mar 23 2006, 05:51 PM:name=milesperhour1086)--][div class=\'quotetop\']QUOTE(milesperhour1086 @ Mar 23 2006, 05:51 PM) [snapback]357686[/snapback][/div][div class=\'quotemain\'][!--quotec--]When creating a page in PHP, if I have the following:[code] php:$thisVar = $myArray[2]; .. .. .. .. $myArray = array(1,43,64,44); ?>[/code]Will thisVar be assigned 64 or will it be null because when we assigned thisVar, myArray did not exist yet?? I am trying to work with dreamWeaver templates and php and this is one of the things I need to figure out but I Don't have webspace to test it out on yet. Thanks[/quote]it'll be null if you do it in this order. scripting languages do everything in line order, the only exceptions being things such as functions, loops (while, for, foreach, etc). your opening php tag must be <?php too, not php: Quote Link to comment https://forums.phpfreaks.com/topic/5613-simple-variable-reference-question/#findComment-20039 Share on other sites More sharing options...
milesperhour1086 Posted March 23, 2006 Author Share Posted March 23, 2006 [!--quoteo(post=357689:date=Mar 23 2006, 09:59 AM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Mar 23 2006, 09:59 AM) [snapback]357689[/snapback][/div][div class=\'quotemain\'][!--quotec--]it'll be null if you do it in this order. scripting languages do everything in line order, the only exceptions being things such as functions, loops (while, for, foreach, etc). your opening php tag must be <?php too, not php:[/quote]thanks Quote Link to comment https://forums.phpfreaks.com/topic/5613-simple-variable-reference-question/#findComment-20041 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.