http://bugs.php.net/bugs.php?id=7553

From: Date: Fri, 08 Dec 2000 19:31:00 +0000
Subject: http://bugs.php.net/bugs.php?id=7553
Groups: php.dev 
Request: Send a blank email to php-dev+get-40586@lists.php.net to get a copy of this message
I agree with the author of the feature request. I have recently run into a situation where extract() proved itself useles. I needed it to extract a dynamically built array, but it's impossible, because extract() checks whether array keys constitute valid variable names WITHOUT prefix. (see http://bugs.php.net/bugs.php?id=8172) I'd like to write my own extract() in PHP (no knowledge of C), but that's impossible too, because of the variable scope implementation in PHP. Of course, I can prepare the array for extraction with something like function prefix( $array , $prefix ) { $retval = array() ; foreach( $array as $k => $v ) { $retval[ $prefix . $k ] = $v ; } return $retval ; } but that's an unnecessary step. What I'm asking is: is it viable to extend Zend / PHP 4 to recognize 'global', 'local', and 'parent' symbol tables? That way, there could be $GLOBALS, $LOCALS, and $PARENTS, and I could easily write my own extract(). Of course, MUCH more would become possible if this was reality, like easy checking of the state of all local variables within a function with print_r( $LOCALS ), etc. If onyone replies to this, please, cc me. I'm not on the list. ____________________________________________________________ Cynic: A member of a group of ancient Greek philosophers who taught that virtue constitutes happiness and that self control is the essential part of virtue. cynic@mail.cz ICQ: 2808 2505

« previous php.dev (#40586) next »