3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'https://www.somehost.com/test/index.html?param1=4&param2=3&param3=2&param4=1&param5=3'; function parse($str) { // parse string to uri array $uri = parse_url($str); // parse query params to array parse_str($uri['query'], $params); // task1. filter params by 3 $params = array_filter($params, function($p) { return (int)$p !== 3; }); // task2. sort params asort($params); // task3. get url $params['url'] = $uri['path']; return $uri['scheme'] . '://' . $uri['host'] . '/?' . http_build_query($params); } echo parse($str);
Output for git.master, git.master_jit, rfc.property-hooks
https://www.somehost.com/?param4=1&param3=2&param1=4&url=%2Ftest%2Findex.html

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
54.85 ms | 401 KiB | 8 Q