How to check if two strings contain the same letters?

前端 未结 2 1336
别那么骄傲
别那么骄傲 2021-01-14 12:06
$textone = \"pate\"; //$_GET
$texttwo = \"tape\";
$texttre = \"tapp\";

if ($textone ??? $texttwo) {
echo \"The two strings contain the same letters\";
}
if ($texton         


        
2条回答
  •  长情又很酷
    2021-01-14 12:47

    use === and !==

    if ($textone === $texttwo) {
        echo "The two strings contain the same letters";
    }else{
        echo "The two strings NOT contain the same letters";
    }
    

    or

    if ($textone === $texttwo) {
        echo "The two strings contain the same letters";
    }
    
    if ($textone !== $texttwo) {
        echo "The two strings NOT contain the same letters";
    }
    

提交回复
热议问题