DEV Community

KhaledDev
KhaledDev

Posted on

Answer: What is Fragment URLs and why to use it

For reading a fragment by the PHP you can use 'parse_url( $url, PHP_URL_FRAGMENT )' function. This function in a built-in PHP function. follow example can help you to understand how to use it:

$url = 'www.example.com\foo.html#bar';
echo '<pre>';
var_dump(parse_url($url, PHP_URL_FRAGMENT));
echo '</pre>';

the result is:

string(3) "bar"

for more information…

Top comments (0)