3v4l.org

run code in 300+ PHP versions simultaneously
<?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 ="@^(utm_source=)?(&)"; preg_match($pattern, $addr, $result); echo $result[0]; // repérer le nom de l'hôte dans l'URL preg_match('@^(?:http://)?([^/]+)@i', "http://www.php.net/index.html", $matches); $host = $matches[0]; echo "OOoo: {$host}\n"; // repérer les deux derniers segments du nom de l'hôte preg_match('/[^.]+\.[^.]+$/', $host, $matches); echo "Le nom de domaine est : {$matches[0]}\n"; ?> echo $addr;
Output for 8.3.0 - 8.3.6
Warning: preg_match(): No ending delimiter '@' found in /in/hn2kJ on line 7 Warning: Trying to access array offset on null in /in/hn2kJ on line 8 OOoo: http://www.php.net Le nom de domaine est : php.net echo $addr;
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Warning: preg_match(): No ending delimiter '@' found in /in/hn2kJ on line 7 Warning: Trying to access array offset on value of type null in /in/hn2kJ on line 8 OOoo: http://www.php.net Le nom de domaine est : php.net echo $addr;
Output for 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
Warning: preg_match(): No ending delimiter '@' found in /in/hn2kJ on line 7 Notice: Trying to access array offset on value of type null in /in/hn2kJ on line 8 OOoo: http://www.php.net Le nom de domaine est : php.net echo $addr;
Output for 5.2.3 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.35, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0 - 7.2.33, 7.3.12 - 7.3.33, 7.4.26
Warning: preg_match(): No ending delimiter '@' found in /in/hn2kJ on line 7 OOoo: http://www.php.net Le nom de domaine est : php.net echo $addr;
Output for 4.4.3 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.2
<br /> <b>Warning</b>: preg_match() [<a href='function.preg-match'>function.preg-match</a>]: No ending delimiter '@' found in <b>/in/hn2kJ</b> on line <b>7</b><br /> OOoo: http://www.php.net Le nom de domaine est : php.net echo $addr;
Output for 4.3.11, 4.4.0 - 4.4.2
<br /> <b>Warning</b>: preg_match(): No ending delimiter '@' found in <b>/in/hn2kJ</b> on line <b>7</b><br /> OOoo: http://www.php.net Le nom de domaine est : php.net echo $addr;
Output for 4.3.0 - 4.3.10
<br /> <b>Warning</b>: No ending delimiter '@' found in <b>/in/hn2kJ</b> on line <b>7</b><br /> OOoo: http://www.php.net Le nom de domaine est : php.net echo $addr;

preferences:
196.73 ms | 402 KiB | 344 Q