3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $addr = "http://www.example.com/?pk_lol=VAgin&utm_campaign=printemps&utm_medium=e-mail&utm_source=newsletter1&utm_content=lien-en-haut"; $source = array ('utm_campaign=', 'utm_medium=', 'utm_source='); $pattern ="/({$source[0]}.[^&]+)&({$source[1]}.[^&]+)&({$source[2]}.[^&]+)&/"; preg_match($pattern, $addr, $result); foreach (range(0,2) as $i) { echo substr($result[$i+1], strlen($source[$i])); } print_r($result);
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
printempse-mailnewsletter1Array ( [0] => utm_campaign=printemps&utm_medium=e-mail&utm_source=newsletter1& [1] => utm_campaign=printemps [2] => utm_medium=e-mail [3] => utm_source=newsletter1 )
Output for hhvm-3.10.0

Process exited with code 153.