3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $whitespace = array( "\u0009" => 'character tab', "\u000a" => 'line feed', "\u000b" => 'line tab', "\u000c" => 'form feed', "\u000d" => 'carriage return', "\u0020" => 'space', "\u0085" => 'next line', "\u00A0" => 'non-breaking space', "\u1680" => 'ogham space', "\u2000" => 'en quad', "\u2001" => 'em quad', "\u2002" => 'en space', "\u2003" => 'em space', "\u2004" => 'three-per-em space', "\u2005" => 'four-per-em space', "\u2006" => 'six-per-em space', "\u2007" => 'figure space', "\u2008" => 'punctuation space', "\u2009" => 'thin space', "\u200a" => 'hair space', "\u2028" => 'line separator', "\u2029" => 'paragraph separator', "\u202f" => 'narrow non-breaking space', "\u205f" => 'medium mathematical space', "\u3000" => 'ideographic space' ); foreach ($whitespace as $char => $name) { $dec = json_decode('"'.$char.'"'); $test = "a{$dec}b"; $test = preg_replace('/\s+/', '', $test); //echo "$name: a{$char}b == $test\n"; if ($test != "ab") { echo "$char ($name) is not matched as whitespace\n"; } }
based on dmdDT
Output for 5.4.41 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
\u0085 (next line) is not matched as whitespace \u00A0 (non-breaking space) is not matched as whitespace \u1680 (ogham space) is not matched as whitespace \u2000 (en quad) is not matched as whitespace \u2001 (em quad) is not matched as whitespace \u2002 (en space) is not matched as whitespace \u2003 (em space) is not matched as whitespace \u2004 (three-per-em space) is not matched as whitespace \u2005 (four-per-em space) is not matched as whitespace \u2006 (six-per-em space) is not matched as whitespace \u2007 (figure space) is not matched as whitespace \u2008 (punctuation space) is not matched as whitespace \u2009 (thin space) is not matched as whitespace \u200a (hair space) is not matched as whitespace \u2028 (line separator) is not matched as whitespace \u2029 (paragraph separator) is not matched as whitespace \u202f (narrow non-breaking space) is not matched as whitespace \u205f (medium mathematical space) is not matched as whitespace \u3000 (ideographic space) is not matched as whitespace
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.2.2 - 5.4.40
\u000b (line tab) is not matched as whitespace \u0085 (next line) is not matched as whitespace \u00A0 (non-breaking space) is not matched as whitespace \u1680 (ogham space) is not matched as whitespace \u2000 (en quad) is not matched as whitespace \u2001 (em quad) is not matched as whitespace \u2002 (en space) is not matched as whitespace \u2003 (em space) is not matched as whitespace \u2004 (three-per-em space) is not matched as whitespace \u2005 (four-per-em space) is not matched as whitespace \u2006 (six-per-em space) is not matched as whitespace \u2007 (figure space) is not matched as whitespace \u2008 (punctuation space) is not matched as whitespace \u2009 (thin space) is not matched as whitespace \u200a (hair space) is not matched as whitespace \u2028 (line separator) is not matched as whitespace \u2029 (paragraph separator) is not matched as whitespace \u202f (narrow non-breaking space) is not matched as whitespace \u205f (medium mathematical space) is not matched as whitespace \u3000 (ideographic space) is not matched as whitespace
Output for 5.2.1
\u0009 (character tab) is not matched as whitespace \u000a (line feed) is not matched as whitespace \u000b (line tab) is not matched as whitespace \u000c (form feed) is not matched as whitespace \u000d (carriage return) is not matched as whitespace \u0020 (space) is not matched as whitespace \u0085 (next line) is not matched as whitespace \u00A0 (non-breaking space) is not matched as whitespace \u1680 (ogham space) is not matched as whitespace \u2000 (en quad) is not matched as whitespace \u2001 (em quad) is not matched as whitespace \u2002 (en space) is not matched as whitespace \u2003 (em space) is not matched as whitespace \u2004 (three-per-em space) is not matched as whitespace \u2005 (four-per-em space) is not matched as whitespace \u2006 (six-per-em space) is not matched as whitespace \u2007 (figure space) is not matched as whitespace \u2008 (punctuation space) is not matched as whitespace \u2009 (thin space) is not matched as whitespace \u200a (hair space) is not matched as whitespace \u2028 (line separator) is not matched as whitespace \u2029 (paragraph separator) is not matched as whitespace \u202f (narrow non-breaking space) is not matched as whitespace \u205f (medium mathematical space) is not matched as whitespace \u3000 (ideographic space) is not matched as whitespace
Output for 5.2.0
Output for 5.0.0 - 5.1.6
Fatal error: Call to undefined function json_decode() in /in/fECqg on line 31
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: json_decode() in /in/fECqg on line 31
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: json_decode() in /in/fECqg on line 31
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: json_decode() in /in/fECqg on line 31