note 74667 deleted from function.array-combine by bjori
| From: | bjori@php.net | Date: | Thu, 21 Feb 2008 20:26:25 +0000 |
| Subject: | note 74667 deleted from function.array-combine by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-136369@lists.php.net to get a copy of this message | ||
Note Submitter: Q1712 at online dot ms
----
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
)