3v4l.org

run code in 300+ PHP versions simultaneously
<?php $addr = "http://10.0.0.4/?utm_source=source1&utm_medium=medium1&utm_campaign=campaign1"; // Parse the url. $tableName = array ('referer_medium', 'referer_source', 'referer_campaign'); $source = array ('utm_campaign=', 'utm_medium=', 'utm_source='); $pattern ="/({$source[0]}.[^&]+)&({$source[1]}.[^&]+)&({$source[2]}.[^&]+)&/"; preg_match($pattern, $addr, $result); // Add the values to the log_visit table. foreach (range(0,2) as $i) { $visitorInfo["{$tableName[$i]}"] = substr($result[$i+1], strlen($source[$i])); } print_r ($visitorInfo);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined array key 1 in /in/9U6RY on line 11 Deprecated: substr(): Passing null to parameter #1 ($string) of type string is deprecated in /in/9U6RY on line 11 Warning: Undefined array key 2 in /in/9U6RY on line 11 Deprecated: substr(): Passing null to parameter #1 ($string) of type string is deprecated in /in/9U6RY on line 11 Warning: Undefined array key 3 in /in/9U6RY on line 11 Deprecated: substr(): Passing null to parameter #1 ($string) of type string is deprecated in /in/9U6RY on line 11 Array ( [referer_medium] => [referer_source] => [referer_campaign] => )

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:
46.68 ms | 402 KiB | 8 Q