比较2个不同编码的字符串

How to make the following strings equal:

$str1 = "Première équation";
$str2 = "Première équation"; 

I tried html_entity_decode($str1) but it doesn't work

I'd use a combination of strcmp and html_entity_decode for binary-safe comparison.

<?php

$str1 = "Première &eacute;quation";
$str2 = "Première équation"; 

var_dump( strcmp(html_entity_decode($str1), $str2) );

https://eval.in/551298

For example;

// 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";
}