3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $url = "https://lh4.googleusercontent.com/-vi8qjz0rz4o/AAAAAAAAAAI/AAAAAAAAaz4/vTzzYBQSL5M/photo.jpg?sz=200"; $parsedUrl = parse_url($url); var_dump($parsedUrl); if ($parsedUrl !== false && is_array($parsedUrl)) { $parsedUrl .= "://"; unset($parsedUrl['query']); unset($parsedUrl['fragment']); $url = implode('', $parsedUrl); } var_dump($url);
based on puGoE
Output for 7.0.0 - 7.2.0
array(4) { ["scheme"]=> string(5) "https" ["host"]=> string(25) "lh4.googleusercontent.com" ["path"]=> string(59) "/-vi8qjz0rz4o/AAAAAAAAAAI/AAAAAAAAaz4/vTzzYBQSL5M/photo.jpg" ["query"]=> string(6) "sz=200" } Notice: Array to string conversion in /in/91Iuv on line 7 Fatal error: Uncaught Error: Cannot unset string offsets in /in/91Iuv:8 Stack trace: #0 {main} thrown in /in/91Iuv on line 8
Process exited with code 255.
Output for 5.4.2 - 5.6.28
array(4) { ["scheme"]=> string(5) "https" ["host"]=> string(25) "lh4.googleusercontent.com" ["path"]=> string(59) "/-vi8qjz0rz4o/AAAAAAAAAAI/AAAAAAAAaz4/vTzzYBQSL5M/photo.jpg" ["query"]=> string(6) "sz=200" } Notice: Array to string conversion in /in/91Iuv on line 7 Fatal error: Cannot unset string offsets in /in/91Iuv on line 8
Process exited with code 255.
Output for 5.3.18 - 5.3.29
array(4) { ["scheme"]=> string(5) "https" ["host"]=> string(25) "lh4.googleusercontent.com" ["path"]=> string(59) "/-vi8qjz0rz4o/AAAAAAAAAAI/AAAAAAAAaz4/vTzzYBQSL5M/photo.jpg" ["query"]=> string(6) "sz=200" } Fatal error: Cannot unset string offsets in /in/91Iuv on line 8
Process exited with code 255.