3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = "https://m.naughtyappetite.com/oth.php?dynamicpage=all_1cm_universal_light_n&ver=1"; $urlParams = array( 'source', 'transfer_to', 'ban_rm', 'pop_rm', 'txt_rm', 'zoneid', 'userid', 'userId', 'ver', 't_uod', 't_umbr', 'email', 'emlTrack', 'key', 'uniqmessageId', 'open', 'transferSource', 'cmpn', 'loc', 'cross', 'crossMask', '_cbUrl', '_disAL', '_fData', 'utm_partner', 'clkid', 'clid', 'clbid', 'safeLP', 'campaigntype', 'redirectUrl', ); $queryString = ""; function getParam($key) { $url = "http://www.thirst-more.com/2207/campaign32813?safeLP=naughty&source=www.benaughty.com&transfer_to=naughtyappetite.com&ban_rm=000748865&zoneid=4661&userId=c078c5c84f7311e79a97441ea14ed80c&key=c7eee25af7c437abaf37c460b8d1f467&clid=927&clbid=33872&location=UKR&remType=Banner&targetSite=6747c8fb5b73abce100992b51af15eef"; $query = parse_url($url, PHP_URL_QUERY); parse_str($query, $params); return isset($params[$key]) ? $params[$key] : null; } $params = array_fill_keys($urlParams, ""); array_walk($params, function(&$item, $key){ $item = getParam($key); }); $params = array_filter($params); if (!empty($params)) { $queryString = http_build_query($params); } if (empty($queryString)) return $url; $pos = strrpos($url,"?"); die(var_dump($url . ( $pos === false ? "?" : "&" ) . $queryString, $queryString, $params));
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
string(280) "https://m.naughtyappetite.com/oth.php?dynamicpage=all_1cm_universal_light_n&ver=1&source=www.benaughty.com&transfer_to=naughtyappetite.com&ban_rm=000748865&zoneid=4661&userId=c078c5c84f7311e79a97441ea14ed80c&key=c7eee25af7c437abaf37c460b8d1f467&clid=927&clbid=33872&safeLP=naughty" string(198) "source=www.benaughty.com&transfer_to=naughtyappetite.com&ban_rm=000748865&zoneid=4661&userId=c078c5c84f7311e79a97441ea14ed80c&key=c7eee25af7c437abaf37c460b8d1f467&clid=927&clbid=33872&safeLP=naughty" array(9) { ["source"]=> string(17) "www.benaughty.com" ["transfer_to"]=> string(19) "naughtyappetite.com" ["ban_rm"]=> string(9) "000748865" ["zoneid"]=> string(4) "4661" ["userId"]=> string(32) "c078c5c84f7311e79a97441ea14ed80c" ["key"]=> string(32) "c7eee25af7c437abaf37c460b8d1f467" ["clid"]=> string(3) "927" ["clbid"]=> string(5) "33872" ["safeLP"]=> string(7) "naughty" }

preferences:
180.19 ms | 405 KiB | 287 Q