Skip to main content
replaced http://us2.php.net with https://www.php.net
Source Link

I think preg_matchis not necessary here.striposstripos is enough for it.

$url = $link->hits;
$pos_google = stripos($url,'google.com');
$pos_yahoo = stripos($url,'yahoo.com');
if($pos_google !== false)
{
     $class = 'google';
}
elseif($pos_yahoo !== false)
{
     $class = 'yahoo';
}
else
{
     #code
}

I think preg_matchis not necessary here.stripos is enough for it.

$url = $link->hits;
$pos_google = stripos($url,'google.com');
$pos_yahoo = stripos($url,'yahoo.com');
if($pos_google !== false)
{
     $class = 'google';
}
elseif($pos_yahoo !== false)
{
     $class = 'yahoo';
}
else
{
     #code
}

I think preg_matchis not necessary here.stripos is enough for it.

$url = $link->hits;
$pos_google = stripos($url,'google.com');
$pos_yahoo = stripos($url,'yahoo.com');
if($pos_google !== false)
{
     $class = 'google';
}
elseif($pos_yahoo !== false)
{
     $class = 'yahoo';
}
else
{
     #code
}
deleted 603 characters in body; added 5 characters in body; added 63 characters in body
Source Link
Young
  • 8.2k
  • 7
  • 44
  • 65

I think preg_matchis not necessary here.strposstripos is enough for it.

$pos_google = strpos($link,'Google.com');
$pos_yahoo$url = strpos($link,'Yahoo.com');
if($pos_google !== false)
{
     $class = 'google';
}
elseif($pos_yahoo !== false)
{
     $class = 'yahoo';
}
else
{
     #code
}

Edit:

If $link is an array like array('aa','bb','Google.com'),then you need a loop to iterate the search.

foreach($link as $linkvalue)
{->hits;
    $pos_google = strposstripos($linkvalue$url,'Google'google.com');
    $pos_yahoo = strposstripos($linkvalue$url,'Yahoo'yahoo.com');
    if($pos_google !== false)
    {
        $class = 'google';
        break;
    }
    elseif($pos_yahoo !== false)
    {
        $class = 'yahoo';
        break;
    }
    else
    {
       #code
       break;
    }
}

I think preg_matchis not necessary here.strpos is enough for it.

$pos_google = strpos($link,'Google.com');
$pos_yahoo = strpos($link,'Yahoo.com');
if($pos_google !== false)
{
     $class = 'google';
}
elseif($pos_yahoo !== false)
{
     $class = 'yahoo';
}
else
{
     #code
}

Edit:

If $link is an array like array('aa','bb','Google.com'),then you need a loop to iterate the search.

foreach($link as $linkvalue)
{
    $pos_google = strpos($linkvalue,'Google.com');
    $pos_yahoo = strpos($linkvalue,'Yahoo.com');
    if($pos_google !== false)
    {
        $class = 'google';
        break;
    }
    elseif($pos_yahoo !== false)
    {
        $class = 'yahoo';
        break;
    }
    else
    {
       #code
       break;
    }
}

I think preg_matchis not necessary here.stripos is enough for it.

$url = $link->hits;
$pos_google = stripos($url,'google.com');
$pos_yahoo = stripos($url,'yahoo.com');
if($pos_google !== false)
{
     $class = 'google';
}
elseif($pos_yahoo !== false)
{
     $class = 'yahoo';
}
else
{
     #code
}
added 577 characters in body
Source Link
Young
  • 8.2k
  • 7
  • 44
  • 65

I think preg_matchis not necessary here.strpos is enough for it.

$pos_google = strpos($link,'Google.com');
$pos_yahoo = strpos($link,'Yahoo.com');
if($pos_google !== false)
{
     $class = 'google';
}
elseif($pos_yahoo !== false)
{
     $class = 'yahoo';
}
else
{
     #code
}

Edit:

If $link is an array like array('aa','bb','Google.com'),then you need a loop to iterate the search.

foreach($link as $linkvalue)
{
    $pos_google = strpos($linkvalue,'Google.com');
    $pos_yahoo = strpos($linkvalue,'Yahoo.com');
    if($pos_google !== false)
    {
        $class = 'google';
        break;
    }
    elseif($pos_yahoo !== false)
    {
        $class = 'yahoo';
        break;
    }
    else
    {
       #code
       break;
    }
}

I think preg_matchis not necessary here.strpos is enough for it.

$pos_google = strpos($link,'Google.com');
$pos_yahoo = strpos($link,'Yahoo.com');
if($pos_google !== false)
{
     $class = 'google';
}
elseif($pos_yahoo !== false)
{
     $class = 'yahoo';
}
else
{
     #code
}

I think preg_matchis not necessary here.strpos is enough for it.

$pos_google = strpos($link,'Google.com');
$pos_yahoo = strpos($link,'Yahoo.com');
if($pos_google !== false)
{
     $class = 'google';
}
elseif($pos_yahoo !== false)
{
     $class = 'yahoo';
}
else
{
     #code
}

Edit:

If $link is an array like array('aa','bb','Google.com'),then you need a loop to iterate the search.

foreach($link as $linkvalue)
{
    $pos_google = strpos($linkvalue,'Google.com');
    $pos_yahoo = strpos($linkvalue,'Yahoo.com');
    if($pos_google !== false)
    {
        $class = 'google';
        break;
    }
    elseif($pos_yahoo !== false)
    {
        $class = 'yahoo';
        break;
    }
    else
    {
       #code
       break;
    }
}
Source Link
Young
  • 8.2k
  • 7
  • 44
  • 65
Loading