3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $input = 'Premium serviço Personal - 1 mês'; $trunc = substr($input, 0, 32); var_dump($input); var_dump($trunc); var_dump( iconv("UTF-8", "UTF-8//IGNORE", $trunc) );
based on CK6il
Output for 5.4.0 - 5.5.34, 5.6.8 - 5.6.20, 5.6.28 - 7.0.5, 7.0.20 - 7.2.0
string(34) "Premium serviço Personal - 1 mês" string(32) "Premium serviço Personal - 1 m�" Notice: iconv(): Detected an incomplete multibyte character in input string in /in/ojGrM on line 9 bool(false)
Output for 7.0.6
string(34) "Premium serviço Personal - 1 mês" string(32) "Premium serviço Personal - 1 m�" Fatal error: Uncaught Error: Call to undefined function iconv() in /in/ojGrM:9 Stack trace: #0 {main} thrown in /in/ojGrM on line 9
Process exited with code 255.
Output for 5.5.35, 5.6.21
string(34) "Premium serviço Personal - 1 mês" string(32) "Premium serviço Personal - 1 m�" Fatal error: Call to undefined function iconv() in /in/ojGrM on line 9
Process exited with code 255.
Output for 5.3.19 - 5.3.29
string(34) "Premium serviço Personal - 1 mês" string(32) "Premium serviço Personal - 1 m�" Notice: iconv(): Detected an incomplete multibyte character in input string in /in/ojGrM on line 9 string(31) "Premium serviço Personal - 1 m"