3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str = 'http://yoursite.com/?site=http://exapmle.com/&site2=http://google.com/'; $parts = parse_url($str); parse_str($parts['query'], $query); $result = array(); foreach($query as $inc => $a_host) { $result[$inc]=parse_url($a_host,'PHP_URL_HOST'); } print_r($result);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Fatal error: Uncaught TypeError: parse_url(): Argument #2 ($component) must be of type int, string given in /in/bBs96:15 Stack trace: #0 /in/bBs96(15): parse_url('http://exapmle....', 'PHP_URL_HOST') #1 {main} thrown in /in/bBs96 on line 15
Process exited with code 255.
Output for 7.3.12 - 7.3.33, 7.4.0 - 7.4.33
Warning: parse_url() expects parameter 2 to be int, string given in /in/bBs96 on line 15 Warning: parse_url() expects parameter 2 to be int, string given in /in/bBs96 on line 15 Array ( [site] => [site2] => )
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33
Warning: parse_url() expects parameter 2 to be integer, string given in /in/bBs96 on line 15 Warning: parse_url() expects parameter 2 to be integer, string given in /in/bBs96 on line 15 Array ( [site] => [site2] => )
Output for 5.1.2 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Warning: parse_url() expects parameter 2 to be long, string given in /in/bBs96 on line 15 Warning: parse_url() expects parameter 2 to be long, string given in /in/bBs96 on line 15 Array ( [site] => [site2] => )
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.1
Warning: parse_url() expects exactly 1 parameter, 2 given in /in/bBs96 on line 15 Warning: parse_url() expects exactly 1 parameter, 2 given in /in/bBs96 on line 15 Array ( [site] => [site2] => )

preferences:
93.07 ms | 2126 KiB | 4 Q