When $café != $café¶
<?php
$v1 = "café";
$v2 = "cafe"."\u{0301}";
print "are '$v1' and '$v2' identical? \n";
var_dump($v1 == $v2); //returns false
$café = 1;
$café = 21;
var_dump($café === $café);
var_dump(array_keys(compact(['café', 'café'])));
Here is a classic feature of unicode: it is possible to build the French e acute in two ways: as one char, or as two: an e and a … acute.
In the end, the two unicode strings are different, though they are mostly dislayed the same way. This applies to names: here it happens with variables, but it is applicable to anything that has a name in PHP. Just note that it is never used in the wild.
It also happens in strings, because they are also written in unicode format. Now, it becomes an input validation challenge. It may be used for by-passing security and validations, but also, it may be a valid user input, depending on the way it was entered in their system.
See Also¶
PHP Features¶
Last updated: 28 August 2026