|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2005-10-13 15:07 UTC] stochnagara at hotmail dot com
 Description: ------------ Currently array_combine returns false and raises a warning if it is used with two empty array and this is documented too. This is quite inconsistent since combining two empty arrays is expected to result in another empty array. If there are so many BC arguments, then this function could be extended with a third optional argument 'accept_empty' which allow the thing I request. P.S. Actually bug #29972 is almost the same and has been marked closed so this could be a reopen of this bug. Reproduce code: --------------- <?php var_dump (array_combine (array(), array())); ?> Expected result: ---------------- array(0) { } Actual result: -------------- Warning: array_combine() [function.array-combine]: Both parameters should have at least 1 element in C:\Program Files\Apache Group\Apache2\htdocs\boroinvest\test.php on line 3 bool(false) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 03:00:01 2025 UTC | 
I am trying to parse the output of "svnlook proplist -v" into an associative array of property keys and property values: $pattern = '/^ ([^ ]+) : ((?:\V|\v[^ ]|\v [^ ])+)/m'; if (false === preg_match_all($pattern, $subject, $matches)) { // Error handling } return array_combine($matches[1], $matches[2]); This works great, unless "svnlook proplist -v" finds no properties. In that case, array_combine() returns false because array() === $matches[1] and array() === $matches[2]. Consequently, I am forced to treat the case when "svnlook proplist -v" finds no properties as a special case. I wish array() === array_combine(array(), array()), as I assumed it would.