3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $re = "/^[a-zA-Z ,.\p{Han}]+$/"; $tests = array( 'Mr Smith', 'Mr. Smith', 'Mr. 123 Smith', '姓名' ); foreach ($tests as $test) { if (preg_match($re, utf8_decode($test)) !== 1) { echo $test . ' failed' . PHP_EOL; } }
based on dmAEc
Output for 4.4.3 - 4.4.9, 5.1.3 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Mr. 123 Smith failed 姓名 failed
Output for 4.4.0 - 4.4.2, 5.0.5 - 5.1.2
Warning: preg_match(): Compilation failed: unknown property name after \P or \p at offset 17 in /in/f2b2G on line 12 Mr Smith failed Warning: preg_match(): Compilation failed: unknown property name after \P or \p at offset 17 in /in/f2b2G on line 12 Mr. Smith failed Warning: preg_match(): Compilation failed: unknown property name after \P or \p at offset 17 in /in/f2b2G on line 12 Mr. 123 Smith failed Warning: preg_match(): Compilation failed: unknown property name after \P or \p at offset 17 in /in/f2b2G on line 12 姓名 failed
Output for 4.3.11, 5.0.2 - 5.0.4
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 12 in /in/f2b2G on line 12 Mr Smith failed Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 12 in /in/f2b2G on line 12 Mr. Smith failed Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 12 in /in/f2b2G on line 12 Mr. 123 Smith failed Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 12 in /in/f2b2G on line 12 姓名 failed
Output for 5.0.0 - 5.0.1
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 12 in /in/f2b2G on line 12 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f2b2G on line 13 Mr Smith failedPHP_EOL Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 12 in /in/f2b2G on line 12 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f2b2G on line 13 Mr. Smith failedPHP_EOL Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 12 in /in/f2b2G on line 12 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f2b2G on line 13 Mr. 123 Smith failedPHP_EOL Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 12 in /in/f2b2G on line 12 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f2b2G on line 13 姓名 failedPHP_EOL
Output for 4.3.10
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 12 in /in/f2b2G on line 12 Mr Smith failed Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 12 in /in/f2b2G on line 12 Mr. Smith failed Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 12 in /in/f2b2G on line 12 Mr. 123 Smith failed Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 12 in /in/f2b2G on line 12 姓名 failed
Output for 4.3.0 - 4.3.9
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 12 in /in/f2b2G on line 12 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f2b2G on line 13 Mr Smith failedPHP_EOL Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 12 in /in/f2b2G on line 12 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f2b2G on line 13 Mr. Smith failedPHP_EOL Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 12 in /in/f2b2G on line 12 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f2b2G on line 13 Mr. 123 Smith failedPHP_EOL Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 12 in /in/f2b2G on line 12 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/f2b2G on line 13 姓名 failedPHP_EOL