3v4l.org

run code in 300+ PHP versions simultaneously
<?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"; } }

preferences:
49.32 ms | 402 KiB | 5 Q