note 116525 added to function.extract
| From: | bob | Date: | Sun, 18 Jan 2015 20:35:59 +0000 |
| Subject: | note 116525 added to function.extract | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-201451@lists.php.net to get a copy of this message | ||
Note that extract() will only create or overwrite variables in the current scope, so
<?
function test(){
$a=Array('b'=>1,'c'=>2);
extract($a);
}
test();
exit("$b");
?>
will produce no output, whereas
<?
function test(){
global $b;
$a=Array('b'=>1,'c'=>2);
extract($a);
}
test();
exit("$b");
?>
will output 1.
----
Server IP: 87.124.126.49
Probable Submitter: 2.31.64.172
----
Manual Page -- http://php.net/manual/en/function.extract.php
Edit -- https://master.php.net/note/edit/116525
Del: integrated -- https://master.php.net/note/delete/116525/integrated
Del: useless -- https://master.php.net/note/delete/116525/useless
Del: bad code -- https://master.php.net/note/delete/116525/bad+code
Del: spam -- https://master.php.net/note/delete/116525/spam
Del: non-english -- https://master.php.net/note/delete/116525/non-english
Del: in docs -- https://master.php.net/note/delete/116525/in+docs
Del: other reasons-- https://master.php.net/note/delete/116525
Reject -- https://master.php.net/note/reject/116525
Search -- https://master.php.net/manage/user-notes.php