note 108872 deleted from language.variables.scope by thiago

From: Date: Thu, 31 May 2012 15:28:29 +0000
Subject: note 108872 deleted from language.variables.scope by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-188327@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- I don't pretend to understand this, but there is something strange when you define or reassign a variable within a statement vs at the top level: fileA: if ( "somecondition" ) $IS_TEST_MODE=TRUE; else $IS_TEST_MODE=FALSE; require "fileB"; fileB: echo "Test mode='{$IS_TEST_MODE}'"; I expected it to echo Test mode = '1' or Test mode = '0' but instead it is Test mode = '' Assignment from the top level does work like expected, so there seems to be something about assignment that affects variable visibility.

« previous php.notes (#188327) next »