3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $url = 'http://api.tivi8k.net/viettel/?cid=160&token=P6cf0Swsh62FKd773_q_Cg&e=1499794112'; $parse = parse_url($url); print_r($parse); function unparse_url($parsed_url) { $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; $user = isset($parsed_url['user']) ? $parsed_url['user'] : ''; $pass = isset($parsed_url['pass']) ? ':' . $parsed_url['pass'] : ''; $pass = ($user || $pass) ? "$pass@" : ''; $path = isset($parsed_url['path']) ? $parsed_url['path'] : ''; $query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : ''; $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : ''; return "$scheme$user$pass$host$port$path$query$fragment"; } $c = 'go'; if (isset($parse['host']) && preg_match('/.*?\.tivi8k\.net/', $parse['host'])) { if (isset($parse['path']) && substr_count($parse['path'], '/') === 2) { $parse['path'] = '/ffff/'; parse_str($parse['query'], $params); if (isset($params['token']) && isset($params['e'])) { $a = array( 'id', 'cid', 'channel' ); foreach ($a as $b) { if(isset($params[$b])) { unset($params[$b]); $params[$c]='ddd'; echo $_GET['bb']; } } $params['token'] = 'hello'; $parse['query'] = http_build_query($params); } } } print_r(unparse_url($parse)); ?>
Output for 5.6.30, hhvm-3.15.4 - 3.21.3, 7.0.0 - 7.3.0rc3
Array ( [scheme] => http [host] => api.tivi8k.net [path] => /viettel/ [query] => cid=160&token=P6cf0Swsh62FKd773_q_Cg&e=1499794112 ) Notice: Undefined index: bb in /in/L4vkS on line 34 http://api.tivi8k.net/ffff/?token=hello&e=1499794112&go=ddd
Output for hhvm-3.22.0
Array ( [scheme] => http [host] => api.tivi8k.net [path] => /viettel/ [query] => cid=160&token=P6cf0Swsh62FKd773_q_Cg&e=1499794112 ) Notice: Undefined index: bb in /in/L4vkS on line -1 http://api.tivi8k.net/ffff/?token=hello&e=1499794112&go=ddd