3v4l.org

run code in 300+ PHP versions simultaneously
<?php function urlHasString($url, $strings) { foreach($strings as $string) { if(strpos($url, $string)) { return true; } } return false; } $url = 'www.test.com#stuff'; $strings = ['#', 'java', 'jpg', 'jpeg', 'png', 'tel']; if(urlHasString($url, $strings)) { echo 'Yes it contains one of the strings'; } else { echo 'No it does not contain any of the strings'; }

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
164.77 ms | 2300 KiB | 12 Q