note 69765 added to language.variables.scope

From: Date: Wed, 20 Sep 2006 05:17:21 +0000
Subject: note 69765 added to language.variables.scope
Groups: php.notes 
Request: Send a blank email to php-notes+get-117337@lists.php.net to get a copy of this message
Be careful, come across this a lot. <?php $var = 'foo'; function function1() { global $var; $new_var = 'bar'; function2(); } function function2() { global $var, $new_var; echo($var . $new_var); } function1(); ?> Outputs foo not foobar. ---- Server IP: 203.16.234.91 Probable Submitter: 58.169.190.158 ---- Manual Page -- http://www.php.net/manual/en/language.variables.scope.php Edit -- https://master.php.net/note/edit/69765 Del: integrated -- https://master.php.net/note/delete/69765/integrated Del: useless -- https://master.php.net/note/delete/69765/useless Del: bad code -- https://master.php.net/note/delete/69765/bad+code Del: spam -- https://master.php.net/note/delete/69765/spam Del: non-english -- https://master.php.net/note/delete/69765/non-english Del: in docs -- https://master.php.net/note/delete/69765/in+docs Del: other reasons-- https://master.php.net/note/delete/69765 Reject -- https://master.php.net/note/reject/69765 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#117337) next »