Scoping?

From: Date: Mon, 28 Jul 2008 23:03:11 +0000
Subject: Scoping?
Groups: php.general 
Request: Send a blank email to php-general+get-277406@lists.php.net to get a copy of this message
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!

« previous php.general (#277406) next »