3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test_str = "I&#039;ll"; function setup_functions(){ global $smcFunc; $smcFunc = array(); $utf8=1; $ent_list = '&(#\d{1,7}|quot|amp|lt|gt|nbsp);'; $ent_check = array('preg_replace(\'~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~e\', \'$smcFunc[\\\'entity_fix\\\'](\\\'\\2\\\')\', ', ')'); $smcFunc += array( 'entity_fix' => create_function('$string', ' $num = substr($string, 0, 1) === \'x\' ? hexdec(substr($string, 1)) : (int) $string; return $num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF) || $num === 0x202E || $num === 0x202D ? \'\' : \'&#\' . $num . \';\';'), 'strlen' => create_function('$string', ' global $smcFunc; return strlen(preg_replace(\'~' . $ent_list . '|.~u' . '\', \'_\', ' . implode('$string', $ent_check) . '));') ); } setup_functions(); echo "Length = " . $smcFunc['strlen']($test_str) . "\n"; ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.29, 8.2.0 - 8.2.21, 8.3.0 - 8.3.9
Fatal error: Uncaught Error: Call to undefined function create_function() in /in/7vgnr:13 Stack trace: #0 /in/7vgnr(23): setup_functions() #1 {main} thrown in /in/7vgnr on line 13
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Deprecated: Function create_function() is deprecated in /in/7vgnr on line 13 Deprecated: Function create_function() is deprecated in /in/7vgnr on line 18 Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /in/7vgnr(18) : runtime-created function on line 3 Length = 0
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.3.32 - 7.3.33
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /in/7vgnr(18) : runtime-created function on line 3 Length = 0
Output for 5.5.24 - 5.5.35, 5.6.7 - 5.6.28
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /in/7vgnr(18) : runtime-created function on line 3 Length = 4
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45
Length = 4

preferences:
275.63 ms | 403 KiB | 350 Q