This method can be reduced to a single line: 

```php
return false !== filter_var($url, FILTER_VALIDATE_URL);
```