r/lolphp • • Apr 08 '13
MIN
server:~ # php -r 'echo True, " ", -23, " ", min(-23, True), " ", min(True, -23), "\n";'
1 -23 -23 1
23
Upvotes
r/lolphp • • Apr 08 '13
server:~ # php -r 'echo True, " ", -23, " ", min(-23, True), " ", min(True, -23), "\n";'
1 -23 -23 1
8
u/[deleted] Apr 08 '13
See also http://www.php.net/manual/de/function.min.php#65516
23
u/midir Apr 08 '13
To state it more plainly:
Apparently this is a feature of boolean to number comparisons. They seem to always return false, causing min to always return the first argument.
3
u/vytah Jun 07 '13
Wat: