note 106706 added to function.max
| From: | milolamar at osu1 dot php dot net | Date: | Tue, 29 Nov 2011 20:14:49 +0000 |
| Subject: | note 106706 added to function.max | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-184811@lists.php.net to get a copy of this message | ||
This might be a gotcha. I cannot explain exactly why this happens. I pass 2 arrays of 1 element
with string keys and integer values.
This might just need documentation or might be a bug. Not sure.
<?php
var_dump(max(array('RewardSingles' => 21), array('DefaultDiscountSingles'
=> 1)));
//Actually returns:
//array(1) { ["DefaultDiscountSingles"]=> int(1) }
//Expected:
//array(1) { ["RewardSingles"]=> int(21) }
?>
----
Server IP: 69.147.83.197
Probable Submitter: 71.43.135.46
----
Manual Page -- http://www.php.net/manual/en/function.max.php
Edit -- https://master.php.net/note/edit/106706
Del: integrated -- https://master.php.net/note/delete/106706/integrated
Del: useless -- https://master.php.net/note/delete/106706/useless
Del: bad code -- https://master.php.net/note/delete/106706/bad+code
Del: spam -- https://master.php.net/note/delete/106706/spam
Del: non-english -- https://master.php.net/note/delete/106706/non-english
Del: in docs -- https://master.php.net/note/delete/106706/in+docs
Del: other reasons-- https://master.php.net/note/delete/106706
Reject -- https://master.php.net/note/reject/106706
Search -- https://master.php.net/manage/user-notes.php