note 87734 added to function.min
| From: | andrewdotjdotdodsonatgmail at osu1 dot php dot net | Date: | Thu, 18 Dec 2008 17:10:48 +0000 |
| Subject: | note 87734 added to function.min | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-148325@lists.php.net to get a copy of this message | ||
min/max works with yyyy-mm-dd dates, e.g.
<?php
$a = array( '2008-10-01', '2008-12-01' );
print min($a); // '2008-10-01'
print max($a); // '2008-12-01'
?>
Which is a unexpected since at the top of this page it says.
"PHP will evaluate a non-numeric string as 0"
And if we cast it as an int then we get the year
<?php
print (int)"2008-01-12"; // 2008
?>
----
Server IP: 92.48.74.199
Probable Submitter: 213.123.186.247
----
Manual Page -- http://www.php.net/manual/en/function.min.php
Edit -- https://master.php.net/note/edit/87734
Del: integrated -- https://master.php.net/note/delete/87734/integrated
Del: useless -- https://master.php.net/note/delete/87734/useless
Del: bad code -- https://master.php.net/note/delete/87734/bad+code
Del: spam -- https://master.php.net/note/delete/87734/spam
Del: non-english -- https://master.php.net/note/delete/87734/non-english
Del: in docs -- https://master.php.net/note/delete/87734/in+docs
Del: other reasons-- https://master.php.net/note/delete/87734
Reject -- https://master.php.net/note/reject/87734
Search -- https://master.php.net/manage/user-notes.php