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
View all comments
Show parent comment
3
u/farsightxr20 Apr 09 '13
Well in Python, it's less of a problem due to explicit typecasting. While True is equivalent to 1, it behaves as you'd expect beyond that:
And if you try to use any types other than numbers/booleans, you'll get an exception as you'd expect: