Why does
var_dump(min(-100, -10, NULL, 10, 100));
return
NULL
Any references to PHP documentation would be much appreciated.
According to the PHP documentation on Comparison Operators , comparing NULL
to anything results in both arguments being converted to bools, with NULL
converting to false
.
Since for numbers, only 0 or 0.0 convert to false , all of the other arguments passed to min are considered greater than NULL.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.