i'm trying match string going last else loop. can please provide help?
$cstg = "<result>true<\/result>"; if (preg_match("/<result>true<\/result>/", $cstg)) { echo "result success"; } else if (preg_match("/\<result\>false\<\/result\>/", $cstg)) { echo "result fail"; } else { echo "something went wrong."; }
issue coming $cstg
string. don't have escape \ in html text. following code working fine:
$cstg = "<result>true</result>"; if( preg_match("/<result>true<\/result>/", $cstg)){ echo "result success"; } elseif (preg_match("/\<result\>false\<\/result\>/", $cstg)){ echo "result fail"; }else{ echo "something went wrong."; }
Comments
Post a Comment