- substr: documentation ( source)
- stripos: documentation ( source)
<?php
$user_url = 'http://example.com/bla/bla/bla/file.ext';
if (stripos($user_url, 'http') === 0) {
$user_url = substr($user_url, 5);
} elseif (stripos($user_url, 'https') === 0) {
$user_url = substr($user_url, 6);
}
echo $user_url;