note 95056 added to function.array-replace
| From: | mail at romansklenar dot cz | Date: | Fri, 11 Dec 2009 03:01:59 +0000 |
| Subject: | note 95056 added to function.array-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-163839@lists.php.net to get a copy of this message | ||
Sorry my mistake - wrong interpretation, late night, nevermind... This should work exactly same as
in PHP 5.3:
<?php
...
$count = func_num_args();
for ($i = 1; $i < $count; $i++) {
...
}
...
?>
Check on this code:
<?php
$base = array('id' => NULL, 'login' => NULL, 'credit' =>
NULL);
$arr1 = array('id' => 2, 'login' => NULL, 'credit' => 5);
$arr2 = array('id' => NULL, 'login' => 'john.doe',
'credit' => 100);
$result = array_replace($base, $arr1, $arr2);
/*
correct output:
array(3) {
"id" => NULL
"login" => string(8) "john.doe"
"credit" => int(100)
}
your output:
array(3) {
"id" => int(2)
"login" => NULL
"credit" => int(5)
}
*/
?>
----
Server IP: 69.147.83.197
Probable Submitter: 78.102.121.202
----
Manual Page -- http://www.php.net/manual/en/function.array-replace.php
Edit -- https://master.php.net/note/edit/95056
Del: integrated -- https://master.php.net/note/delete/95056/integrated
Del: useless -- https://master.php.net/note/delete/95056/useless
Del: bad code -- https://master.php.net/note/delete/95056/bad+code
Del: spam -- https://master.php.net/note/delete/95056/spam
Del: non-english -- https://master.php.net/note/delete/95056/non-english
Del: in docs -- https://master.php.net/note/delete/95056/in+docs
Del: other reasons-- https://master.php.net/note/delete/95056
Reject -- https://master.php.net/note/reject/95056
Search -- https://master.php.net/manage/user-notes.php