Please reply to the list so that everyone may benefit from your questions.

> --- Ben Ramsey <[EMAIL PROTECTED]> wrote:
>
>>Here's my take on it.  Pull all your values into one
>>long string:
>
> (cut)
>
>>if (($timestamp = strtotime($date_string)) === -1) {
>>     // Not a valid date; do some error reporting
>>here
>>} else {
>>     // It is a valid date, $timestamp is now a
>>valid Unix
>>     // timestamp of $date_string; use it like
>>below:
>>     echo date("m/d/Y", $timestamp);
>>}
>
Is that an error - Or propper PHP code ?

Ive seen $a == 34 etc - with TWO equals signs. - But
havnt seen it with 3 before.

Yes, it's proper code. See the manual for more details. http://www.php.net/manual/en/language.operators.comparison.php

- Has PHP got 'regex' capability - & comparing text
case IN-sensitivly ?? IE "Cat" equals "CaT" equals
"cat" equals "CAT"..

Also "Cat in the hat" is TRUE - if I 'regex' & want to
see if 'Cat' is in the string (case in-sensitive)...

Indeed. PHP does have regex capability. You should take a good look at the manual. It will answer all of your questions.


Perl-compatible regular expressions: http://www.php.net/pcre
POSIX Extended regular expressions: http://www.php.net/regex

I would suggest using PCRE. There is a increased speed performance difference, I believe. You can perform case insensitive and case sensitive searches with PCRE. Just read the manual, and ask here if you have any questions with code after that.

Also, note that ("cat" == "cat") but ("Cat" != "CaT"). However, I wouldn't do a string comparison like that, though PHP is definately capable of it. I would use strcmp() or strcasecmp(), the latter of which is case insensitive. Check the manual for their usage, and note that they return zero (0) on true.

--
Regards,
 Ben Ramsey
 http://benramsey.com
 http://www.phpcommunity.org/wiki/People/BenRamsey

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to