> -----Original Message-----
> From: Chris Knipe [mailto:[EMAIL PROTECTED]]
> Sent: 17 June 2002 09:28
> 
> Is this right?  It seems to me that substr is working in reverse?
> 
> $string = "1234567890"; // Always numerical, always 10 chars.
> if (!substr($string, 0, -7) == "083") {
>   echo "not 083\n";
> } else {
>   // Exists here.
>   echo "is 083\n";
> }
> 
> Due to the reverse if, shouldn't it exit not 083?

But you haven't inverted the if, just the substr; the above is the same as:

  if ( (!substr($string, 0, -7)) == "083") {

which doesn't actually make a lot of sense!

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

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

Reply via email to