3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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'); $tags = array ('utm_medium=', 'utm_source=', 'utm_campaign='); $results = explode("&", $addr); print_r($results); foreach ($tags as $key => $tag){ $visitorInfo["{$tableName[$key]}"] = $_GET["{$tag}"]; }
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => http://10.0.0.4/?utm_source=source1 [1] => utm_medium=medium1 [2] => utm_campaign=campaign1 ) Notice: Undefined index: utm_medium= in /in/rboSM on line 13 Notice: Undefined index: utm_source= in /in/rboSM on line 13 Notice: Undefined index: utm_campaign= in /in/rboSM on line 13
Output for 4.3.0 - 5.2.17
Array ( [0] => http://10.0.0.4/?utm_source=source1 [1] => utm_medium=medium1 [2] => utm_campaign=campaign1 ) Notice: Undefined index: utm_medium= in /in/rboSM on line 13 Notice: Undefined index: utm_source= in /in/rboSM on line 13 Notice: Undefined index: utm_campaign= in /in/rboSM on line 13