3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Test{ function __construct(){ $this->page="Test<br/>Test hého"; } function text(){ echo "\n START\n"; var_dump(mb_detect_encoding($this->page)); echo "\n 1: "; var_dump(mb_detect_encoding($this->page)); echo "\n 2: "; var_dump(mb_detect_encoding(htmlentities($this->page, ENT_IGNORE, 'UTF-8'))); $this->page = html_entity_decode($this->page); echo "\n 3: "; var_dump(mb_detect_encoding($this->page)); } } $a=new Test(); $a->text(); ?>
based on piGhU
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.0rc3
START string(5) "UTF-8" 1: string(5) "UTF-8" 2: string(5) "ASCII" 3: string(5) "UTF-8"