Scoping?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm new to php. My understanding of php scoping in v5 is that within a file
there are only two scopes, main and in function.

Why doesn't this work?

-------

$err = "original value";
$page = "<html><font color=\"red\"> {$err} </font>Some more HTML</html>";

if(something)
{
    $err = "this error";

    // $err retains original value instead of becoming "this error"
    print $page;
}

else(something else)
{
    $err = "that error";

    // $err retains original value instead of becoming "that error"
    print $page;
}
--------

Thanks much!

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux