note 7997 modified in Variable scope by ronabop

From: Date: Wed, 13 Dec 2000 06:14:04 +0000
Subject: note 7997 modified in Variable scope by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-8675@lists.php.net to get a copy of this message
What needs documenting is how scoping applies to the HTML-interpolatedness of PHP. <?php $a = 'foo'; $b = 'bar'; ?> text text text plain ol' HTML text <?php echo $a . $b; ?> So will this echo statement return "foobar" or "" ? It turns out that the former is correct: "global" means the entire file, not just that particular chunk of PHP within the file. Which only makes sense, given the examples of ASP and JavaScript, but it needs saying. http://www.php.net/manual/variable-scope.php

« previous php.notes (#8675) next »