3v4l.org

run code in 300+ PHP versions simultaneously
<?php $reg_exUrl = "/((http|https)\:\/\/|(www)\.)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/"; $text = 'demo www.google.bg'; preg_match_all($reg_exUrl, $text, $matches); $usedPatterns = array(); foreach($matches[0] as $pattern){ if(!array_key_exists($pattern, $usedPatterns)){ $usedPatterns[$pattern]=true; if(preg_match('%https',)) $text = str_replace ($pattern, "<a href='{$pattern}' target='_blank'>{$pattern}</a> ", $text); } } echo $text;
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught ArgumentCountError: preg_match() expects at least 2 arguments, 1 given in /in/qQK68:10 Stack trace: #0 /in/qQK68(10): preg_match('%https') #1 {main} thrown in /in/qQK68 on line 10
Process exited with code 255.
Output for 7.3.16 - 7.3.33, 7.4.3 - 7.4.33
Warning: preg_match() expects at least 2 parameters, 1 given in /in/qQK68 on line 10 demo www.google.bg
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.28, 7.2.29 - 7.2.33
Parse error: syntax error, unexpected ')' in /in/qQK68 on line 10
Process exited with code 255.

preferences:
164.34 ms | 402 KiB | 198 Q