Following is my code in which i am facing only one difficulty that when i run the following script then due to comparison failure the $flag doesnot echo kindly let me know how to fix this?
$s = "iph4on comes";
$se = "4gb comes in iphone";
$f = 0;
$tf = explode(" ",$searching);
$ms= explode(" ",$search_in);
foreach($tf as $word)
{
if (!preg_match("/$word/i", $search_in))
//if (!strpos($search_in, $word));
return false;
}
{
$f = 1;
}
echo $f;
//Due to return flase above i am not echoing
echo "Comparison Failed";
returnterminates the currently executing code block and “returns” to whatever called that code. if you execute a return in the top level of the code, it’s essentially anexit()call and your echo will never be reached.