3v4l.org

run code in 300+ PHP versions simultaneously
<?php $some_string = "Ку Ку"; $arra_c = array("UCS-4", "UCS-4BE", "UCS-4LE", "UCS-2", "UCS-2BE", "UCS-2LE", "UTF-32", "UTF-32BE", "UTF-32LE", "UTF-16", "UTF-16BE", "UTF-16LE", "UTF-7", "UTF7-IMAP", "UTF-8", "ASCII", "EUC-JP", "SJIS", "eucJP-win", "SJIS-win", "ISO-2022-JP", "ISO-2022-JP-MS", "CP932", "CP51932", "SJIS-mac", "SJIS-Mobile#DOCOMO", "SJIS-Mobile#KDDI", "SJIS-Mobile#SOFTBANK", "UTF-8-Mobile#DOCOMO", "UTF-8-Mobile#KDDI-A", "UTF-8-Mobile#KDDI-B", "UTF-8-Mobile#SOFTBANK", "ISO-2022-JP-MOBILE#KDDI", "JIS", "JIS-ms", "CP50220", "CP50220raw", "CP50221", "CP50222", "ISO-8859-1", "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", "ISO-8859-5", "ISO-8859-6", "ISO-8859-7", "ISO-8859-8", "ISO-8859-9", "ISO-8859-10", "ISO-8859-13", "ISO-8859-14", "ISO-8859-15", "byte2be", "byte2le", "byte4be", "byte4le", "BASE64", "HTML-ENTITIES", "7bit", "8bit", "EUC-CN", "CP936", "GB18030", "HZ", "EUC-TW", "CP950", "BIG-5", "EUC-KR", "UHC",// (CP949) "ISO-2022-KR", "Windows-1251",// (CP1251) "Windows-1252",// (CP1252) "CP866",// (IBM866) "KOI8-R"); //foreach($arra_c as $k => $v){ var_dump([mb_strimwidth($some_string,0,40,'...'),strlen(mb_strimwidth($some_string,0,40,'...'))]); //var_dump(json_encode(array('message' => str_replace(array('\u041a','\u0443'), array('',''), $some_string)))); //} //var_dump(mb_detect_encoding($some_string)); //var_dump(strlen(json_encode(array('message' => $some_string))));
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
array(2) { [0]=> string(9) "Ку Ку" [1]=> int(9) }
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/m438d on line 81
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[', expecting ')' in /in/m438d on line 81
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/m438d on line 81
Process exited with code 255.

preferences:
178.24 ms | 401 KiB | 315 Q