3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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); } die(var_dump($queryString, $params));
Output for 5.6.30
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" }