Jump to content

Archived

This topic is now archived and is closed to further replies.

milesperhour1086

Simple Variable reference Question

Recommended Posts

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

Share this post


Link to post
Share on other sites
[!--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:

Share this post


Link to post
Share on other sites
[!--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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.