note 74667 added to function.array-combine
| From: | Q1712 at online dot ms | Date: | Mon, 23 Apr 2007 00:56:13 +0000 |
| Subject: | note 74667 added to function.array-combine | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-125775@lists.php.net to get a copy of this message | ||
If a value is existing twice in the $keys-array the last one overwrites the others, wich makes the
returned array shorter than the given once, as usual.
If a value of the values-array is double/float, bool or array the string representaion is used, not
the integer representation as usual.
<?php
print_r(
combine(
array('a', 'a', 'a', 0, false, 1, true, 2, 7/3),
array("first 'a'", "second 'a'", "third
'a'", "0", "false", "1", "true",
"2", "7/3")
)
);
print_r(
array ('a' => "first 'a'", 'a' => "second
'a'", 'a' => "third 'a'", 0 => "0",
false => "false", 1 => "1", true => "true", 2 =>
"2", 7/3 => "7/3")
);
?>
prints:
Array
(
[a] => third 'a'
[0] => 0
[] => false
[1] => true
[2] => 2
[2.33333333333] => 7/3
)
Array
(
[a] => third 'a'
[0] => false
[1] => true
[2] => 7/3
)
----
Server IP: 69.147.83.197
Probable Submitter: 84.158.103.127
----
Manual Page -- http://www.php.net/manual/en/function.array-combine.php
Edit -- https://master.php.net/note/edit/74667
Del: integrated -- https://master.php.net/note/delete/74667/integrated
Del: useless -- https://master.php.net/note/delete/74667/useless
Del: bad code -- https://master.php.net/note/delete/74667/bad+code
Del: spam -- https://master.php.net/note/delete/74667/spam
Del: non-english -- https://master.php.net/note/delete/74667/non-english
Del: in docs -- https://master.php.net/note/delete/74667/in+docs
Del: other reasons-- https://master.php.net/note/delete/74667
Reject -- https://master.php.net/note/reject/74667
Search -- https://master.php.net/manage/user-notes.php