3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $video_url = 'http://www.google.com'; $needles = array('http://', 'https://'); // Normalise the URLs foreach ($needles as $key => $needle) { if (strpos($video_url, $needle) === false) { unset($needle[$key]); } } if (count($needles)) { $video_url = $video_url; } else { $video_url = 'http://' . $video_url; } echo $video_url;
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Cannot unset string offsets in /in/PSaNv:10 Stack trace: #0 {main} thrown in /in/PSaNv on line 10
Process exited with code 255.
Output for 5.0.0 - 5.6.28, hhvm-3.12.0
Fatal error: Cannot unset string offsets in /in/PSaNv on line 10
Process exited with code 255.
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.0 - 4.4.9
http://www.google.com