note 57522 deleted from function.array-diff by googleguy

From: Date: Tue, 22 Oct 2013 06:46:54 +0000
Subject: note 57522 deleted from function.array-diff by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-196637@lists.php.net to get a copy of this message
Note Submitter: penguin at antarctida dot ru ---- Interesting effect... I just wanted to see, what variables are created and not unset after some actions. So I write: <?php $a_var_GlobalsBefore = $GLOBALS; ?> ...some actions with variables <?php $a_var_GlobalsAfter = $GLOBALS; $a_var_VariablesNotUnset = array_diff ($a_var_GlobalsAfter, $a_var_GlobalsBefore); ?> ...and _ALL_ variables puff up in smoke. Have no idea what causes this behavior, but found a nice workaround: <?php $a_var_GlobalsBefore = array_keys ($GLOBALS); ?> ...some actions with variables <?php $a_var_GlobalsAfter = array_keys ($GLOBALS); $a_var_VariablesNotUnset = array_diff ($a_var_GlobalsAfter, $a_var_GlobalsBefore); ?> ...and the unset variables are here.

« previous php.notes (#196637) next »