View Single Post
  #3  
Old 08-17-2006, 02:05 PM
sinister sinister is offline
OSP Starters
 
Join Date: Jul 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
sinister is on a distinguished road
Default

Quote:
Originally Posted by ENIGMA
if ($something=='AA' || $something=='AB' || ...)

-OR-

strpos('AAABCD', $something)
Those two notation are NOT equivalent, Code:

<?php

$something = 'AAA';

if ($something=='AA' || $something=='AB')
{
echo '<li>Found using method 1</li>';
}
else
{
echo '<li>Not found using method 1</li>';
}

if (strpos('AAABCD', $something) !== false)
{
echo '<li>Found using method 2</li>';
} < -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
  Webmaster Forums - View Single Post - What is IN (..VALUES..) in PHP?
View Single Post
  #3  
Old 08-17-2006, 02:05 PM
sinister sinister is offline
OSP Starters
 
Join Date: Jul 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
sinister is on a distinguished road
Default

Quote:
Originally Posted by ENIGMA
if ($something=='AA' || $something=='AB' || ...)

-OR-

strpos('AAABCD', $something)
Those two notation are NOT equivalent, Code:

<?php

$something = 'AAA';

if ($something=='AA' || $something=='AB')
{
echo '<li>Found using method 1</li>';
}
else
{
echo '<li>Not found using method 1</li>';
}

if (strpos('AAABCD', $something) !== false)
{
echo '<li>Found using method 2</li>';
} < -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote