3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php var_dump(strlen(iconv('utf-8', 'utf-16le', 'A B C')) / 2); # correct var_dump(strlen(iconv('utf-8', 'utf-16le', '🎖')) / 2); # correct var_dump(strlen(mb_convert_encoding('A B C', 'UTF-32BE', 'UTF-8')) / 2); # off by 5 chars var_dump(strlen(mb_convert_encoding('🎖', 'UTF-32BE', 'UTF-8')) / 2); # correct var_dump(mb_strlen(mb_convert_encoding('A B C', 'UTF-32BE', 'UTF-8')) / 2); # off by 5 chars var_dump(mb_strlen(mb_convert_encoding('🎖', 'UTF-32BE', 'UTF-8')) / 2); # correct
based on pTAK9
Output for 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.30 - 7.3.0alpha1
int(5) int(2) int(10) int(2) int(10) float(1.5)