Jump to content

Simple Variable reference Question


milesperhour1086

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
Link to comment
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:
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.