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"; $pattern = array ("/(utm_campaign=.[^&]+)/i", "/(utm_medium=.[^&]+)/i", "/(utm_source=.[^&]+)/i"); foreach ( $pattern as $p) { preg_match($p, $addr, $result); print_r($result); }
Output for 4.3.0 - 7.1.0
Array ( [0] => utm_campaign=printemps [1] => utm_campaign=printemps ) Array ( [0] => utm_medium=e-mail [1] => utm_medium=e-mail ) Array ( [0] => utm_source=newsletter1 [1] => utm_source=newsletter1 )