I need to match two string using PHP. Here is my code:
<?php
$fistno="9937229853";
$secondno="+919937229853";
?>
Here I need the value in $fistno is present in $secondno or not. If the value in $fistno is present in $secondno it will return true. In this case 9937229853 is present in $secondno so it should return true.
Use strpos
if (strpos($fistno, $secondno) !== false) {
echo 'true';
}
You need to use == not just =
$check = 'this is a string 111';
if (strpos($mystring, $findme) === false) {
echo 'perfect match';
}
else {
echo 'it did not match up';
}
= will assign the variable.
== will do a loose comparison.
=== will do a strict comparison.