“ENTP” “ISTP”这2个字符串怎么单个字符进行比较?
“ENTP” “ISTP”这2个字符串,我要统计两者中相同字符的个数,请问怎么做?在线等!
谢谢!
——解决方案—————–2本文来源gaodaima#com搞(代@码$网6
搞gaodaima代码
—
- PHP code
$str1="ENTP";$str2="ISTP";$count=0;for($i=0;$i<strlen($str1);$i++){ if($str1{$i}==$str2{$i}) $count++;}echo $count;