如何使以下字符串相等:
$str1 = "Première équation";
$str2 = "Première équation";
我尝试了html_entity_decode($str1),但它不工作
我会使用strcmp
和html_entity_decode
的组合进行二进制安全比较。
<?php
$str1 = "Première équation";
$str2 = "Première équation";
var_dump( strcmp(html_entity_decode($str1), $str2) );
https://eval.in/551298
例如;
// Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.
if( strcmp(html_entity_decode($str1), $str2) === 0 ) {
echo "They match";
}