Jump to content

Identical Operator


MrHellism

Recommended Posts

Hey friends, I just started learning php. I want to know the difference between == and === 

 

I exactly want to know the comment section of the given code below.

 

Thanks.  :happy-04:

 

<?php
$mystring 
'abc';
$findme   'a';
$pos strpos($mystring$findme);

// The !== operator can also be used.  Using != would not work as expected
// because the position of 'a' is 0. The statement (0 != false) evaluates 
// to false.

if ($pos !== false) {
     echo 
"The string '$findme' was found in the string '$mystring'";
         echo 
" and exists at position $pos";
} else {
     echo 
"The string '$findme' was not found in the string '$mystring'";
}

?>

Link to comment
https://forums.phpfreaks.com/topic/294702-identical-operator/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.