On 12/14/05, Greg Beaver <[EMAIL PROTECTED]> wrote:
> In this case, a string is explicitly being compared to a string, and yet
> both are being converted to an int prior to comparison.  I can
> understand that implicit type conversion is needed when comparing
> strings to ints, but this can be dangerous.  phpDocumentor, for instance
> uses this code:
>
> if (in_array(substr($ltrimword, 0, 2), array('1.', '0.')))

Perhaps

if (preg_match('/^[10]\./',$ltrimword))

would be both more concise and express your intent better?

Regards,
Jason
http://blog.casey-sweat.us/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to