3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // Parse the url. $addr = "http://www.example.com/?pk_lol=VAgin&utm_campaign=printemps&utm_medium=e-mail&utm_source=newsletter1&utm_content=lien-en-haut"; $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); $lol = sprintf(); foreach (range(0,2) as $i) { $visitorInfo["{$tableName[$i]}"] = substr($result[$i+1], strlen($source[$i])); } print_r($visitorInfo);
Output for 5.3.0 - 5.6.25, 7.0.0 - 7.1.0
Warning: sprintf() expects at least 1 parameter, 0 given in /in/OSMKp on line 12 Array ( [referer_medium] => printemps [referer_source] => e-mail [referer_campaign] => newsletter1 )
Output for hhvm-3.10.0 - 3.12.0
Warning: sprintf() expects exactly 1 parameter, 0 given in /in/OSMKp on line 12 Array ( [referer_medium] => printemps [referer_source] => e-mail [referer_campaign] => newsletter1 )
Output for 4.3.0 - 5.2.17
Warning: Wrong parameter count for sprintf() in /in/OSMKp on line 12 Array ( [referer_medium] => printemps [referer_source] => e-mail [referer_campaign] => newsletter1 )