3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo ">>> (1)\n"; $string = 'Text1234567890Text'; print_r(preg_match('/[\p{Latin}\p{N}]+/u', $string, $m)); echo "\n---\n"; print_r($m); echo "\n-------------------------\n\n"; echo ">>> (2)\n"; $string = 'Text1234567890Text'; print_r(preg_match('/[a-zA-Z\p{N}]+/u', $string, $m)); echo "\n---\n"; print_r($m); echo "\n-------------------------\n\n"; echo ">>> (3)\n"; $string = 'Text1234567890Text'; print_r(preg_match('/[\p{N}]+/u', $string, $m)); echo "\n---\n"; print_r($m); echo "\n-------------------------\n\n"; echo ">>> (4)\n"; $string = 'TextабвгText'; print_r(preg_match('/^[\p{Latin}\p{Cyrillic}]+$/u', $string, $m)); echo "\n---\n"; print_r($m);
Output for 4.4.3 - 4.4.9, 5.1.3 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.24, 7.4.12 - 7.4.13, 8.0.0
>>> (1) 1 --- Array ( [0] => Text1234567890Text ) ------------------------- >>> (2) 1 --- Array ( [0] => Text1234567890Text ) ------------------------- >>> (3) 1 --- Array ( [0] => 1234567890 ) ------------------------- >>> (4) 1 --- Array ( [0] => TextабвгText )
Output for 7.4.0 - 7.4.11
>>> (1) 1 --- Array ( [0] => Text ) ------------------------- >>> (2) 1 --- Array ( [0] => Text1234567890Text ) ------------------------- >>> (3) 1 --- Array ( [0] => 1234567890 ) ------------------------- >>> (4) 1 --- Array ( [0] => TextабвгText )
Output for 4.4.0 - 4.4.2, 5.0.5, 5.1.0 - 5.1.2
>>> (1) Warning: preg_match(): Compilation failed: unknown property name after \P or \p at offset 9 in /in/XFEue on line 5 --- Array ( ) ------------------------- >>> (2) 1 --- Array ( [0] => Text1234567890Text ) ------------------------- >>> (3) 1 --- Array ( [0] => 1234567890 ) ------------------------- >>> (4) Warning: preg_match(): Compilation failed: unknown property name after \P or \p at offset 10 in /in/XFEue on line 29 --- Array ( )
Output for 4.3.11, 5.0.0 - 5.0.4
>>> (1) Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 2 in /in/XFEue on line 5 --- Array ( ) ------------------------- >>> (2) Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 8 in /in/XFEue on line 13 --- Array ( ) ------------------------- >>> (3) Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 2 in /in/XFEue on line 21 --- Array ( ) ------------------------- >>> (4) Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/XFEue on line 29 --- Array ( )
Output for 4.3.0 - 4.3.10
>>> (1) Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 2 in /in/XFEue on line 5 --- Array ( ) ------------------------- >>> (2) Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 8 in /in/XFEue on line 13 --- Array ( ) ------------------------- >>> (3) Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 2 in /in/XFEue on line 21 --- Array ( ) ------------------------- >>> (4) Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in /in/XFEue on line 29 --- Array ( )