note 59761 deleted from function.array-diff by cmb
| From: | cmb@php.net | Date: | Sun, 17 Mar 2019 09:29:58 +0000 |
| Subject: | note 59761 deleted from function.array-diff by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-210387@lists.php.net to get a copy of this message | ||
Note Submitter: white_phoenix at ru dot ru
----
To: effectpenguin at antarctida dot ru
Re: interesting effect
<?php
function arraycpy(&$target,&$array)
{
if (!is_array($target)) {$target = array();}
foreach($array as $k=>$v) {if ($k != "GLOBALS") {$target[$k] = $v;}}
}
arraycpy($old,$GLOBALS);
// some actions with variables:
$homer = "beer";
arraycpy($new,$GLOBALS);
$diff = array_diff($new,$old);
var_dump($diff);
?>
array(1) {
["homer"]=>
string(4) "beer"
}
Windows NT WPX_NB 5.1 build 2600 PHP/5.0.4