parse_url yielding NULL

I’m trying to use parse_url() to get the fragment from the url

Here is the code:

$origin_id = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_FRAGMENT);
var_dump( $origin_id );

the var_dump is giving me NULL so it looks like no value is assigned. I must have missed something, but googling around hasn’t turned up any ideas.
I’m new to PHP so please be kind if this is a ‘newbie’ error

You are asking to assign the fragment after the hashmark

http://php.net/manual/en/function.parse-url.php

Are you sure $_SERVER['REQUEST_URI'] has one?

var_dump( $_SERVER['REQUEST_URI'] );
$origin_id = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_FRAGMENT);
var_dump( $origin_id );

@Mittineague
Thank you! It was a newbie mistake, and you helped me track it down!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.