Re: Strange ....Date problem
| From: | Rasmus Lerdorf | Date: | Sun, 10 Nov 2002 16:49:18 +0000 |
| Subject: | Re: Strange ....Date problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-123707@lists.php.net to get a copy of this message | ||
Why is it strange? By default strings are sorted alphabetically. 6 > 10
when sorted alphabetically. Convert your strings to numbers in some
logical manner and compare numbers or easier, use strnatcmp() to compare
the strings directly using a natural alphanumeric comparison.
-Rasmus
On Sun, 10 Nov 2002, Dhaval Desai wrote:
> Hi!
>
> If you try this in php:
>
> 2002-01-6 > 2002-01-10
> returns true
>
> 2002-01-6 > 2002-01-9
> returns false
>
> Jut a leading 0 in the date makes it false...this is really strange..
>
> Any comments?
>
>
>
>
>
> _________________________________________________________________
> Add photos to your messages with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>