3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = <<<TEXT – 2.2.04 R –– 2.2.04.10 C –– 2.2.04.1 CO –– 2.2.04.2 CO –– 2.2.04.3 CO –– 2.2.04.4 CO –– 2.2.04.5 CO –– 2.2.04.6 CO –– 2.2.04.7 CO –– 2.2.04.8 CO –– 2.2.04.9 CO TEXT; $arr = explode("\n", $text); $pattern = '/^([\p{Pd}]*\s*2\.2\.|2\.2\.)/'; foreach ($arr as $string) { if (preg_match($pattern, $string)) { echo $string.' — Match!'; } else { echo $string.' — Not match!'; } echo PHP_EOL; }
Output for 5.2.10 - 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.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
– 2.2.04 R — Not match! –– 2.2.04.10 C — Not match! –– 2.2.04.1 CO — Not match! –– 2.2.04.2 CO — Not match! –– 2.2.04.3 CO — Not match! –– 2.2.04.4 CO — Not match! –– 2.2.04.5 CO — Not match! –– 2.2.04.6 CO — Not match! –– 2.2.04.7 CO — Not match! –– 2.2.04.8 CO — Not match! –– 2.2.04.9 CO — Not match!
Output for 4.4.0 - 4.4.9, 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.9
– 2.2.04 R — Match! –– 2.2.04.10 C — Match! –– 2.2.04.1 CO — Match! –– 2.2.04.2 CO — Match! –– 2.2.04.3 CO — Match! –– 2.2.04.4 CO — Match! –– 2.2.04.5 CO — Match! –– 2.2.04.6 CO — Match! –– 2.2.04.7 CO — Match! –– 2.2.04.8 CO — Match! –– 2.2.04.9 CO — Match!
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 4 in /in/ThFQ3 on line 21 – 2.2.04 R — Not match! Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.10 C — Not match! Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.1 CO — Not match! Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.2 CO — Not match! Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.3 CO — Not match! Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.4 CO — Not match! Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.5 CO — Not match! Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.6 CO — Not match! Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.7 CO — Not match! Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.8 CO — Not match! Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.9 CO — Not match!
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 4 in /in/ThFQ3 on line 21 – 2.2.04 R — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.10 C — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.1 CO — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.2 CO — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.3 CO — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.4 CO — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.5 CO — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.6 CO — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.7 CO — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.8 CO — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.9 CO — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL
Output for 4.3.10
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 – 2.2.04 R — Not match! Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.10 C — Not match! Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.1 CO — Not match! Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.2 CO — Not match! Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.3 CO — Not match! Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.4 CO — Not match! Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.5 CO — Not match! Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.6 CO — Not match! Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.7 CO — Not match! Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.8 CO — Not match! Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.9 CO — Not match!
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 4 in /in/ThFQ3 on line 21 – 2.2.04 R — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.10 C — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.1 CO — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.2 CO — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.3 CO — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.4 CO — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.5 CO — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.6 CO — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.7 CO — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.8 CO — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 4 in /in/ThFQ3 on line 21 –– 2.2.04.9 CO — Not match! Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/ThFQ3 on line 26 PHP_EOL

preferences:
302.38 ms | 409 KiB | 459 Q