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 = 'some text http://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://%',$pattern)) { //$start = "https://"; } elseif(preg_match('%http://%',$pattern)) { //$start = "http://"; } else { $start = "http://"; } $text = str_replace ($pattern, "<a href='".isset($start) ? $start : ''."{$pattern}' target='_blank'>{$pattern}</a> ", $text); } } echo $text;
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $start in /in/I2pRc on line 23 Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /in/I2pRc on line 23 some text

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
39.02 ms | 401 KiB | 8 Q