3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php /* The Euro sign--U+20AC--followed by " hi there", in UTF-8. */ $teststr = "\xe2\x82\xac hi there"; /* Split it into individual characters, passing the /u flag to tell PCRE to interpret the string as UTF-8. */ $testchars = preg_split('//u', $teststr, -1, PREG_SPLIT_NO_EMPTY); /* Get some output that should be equivalent. */ preg_match_all('/./u', $teststr, $matches); $goodtestchars = $matches[0]; /* The arrays should be the same length. */ print "This should be 1: '".(count($testchars) == count($goodtestchars))."'\n"; /* And the octet count of the first entry should be three for both arrays. */ print 'These both should be three: '; print strlen($testchars[0]).', '.strlen($goodtestchars[0]). "\n";
Output for 5.0.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
This should be 1: '1' These both should be three: 3, 3
Output for hhvm-3.10.0

Process exited with code 137.
Output for 4.3.5 - 4.4.9
This should be 1: '' These both should be three: 12, 3
Output for 4.3.0 - 4.3.4
This should be 1: '' These both should be three: 1, 3