I am trying to use url rewriting on my website and I want to use the list()
and explode()
functions to get the right content.
Currently my code looks like this:
list($dir, $act) = explode('/',$url);
In this case $url
is equal to everything after the first slash in the absolute url i.e. http://example.com/random/stuff => $url = random/stuff/
this would work fine, but if I want to go to http://example.com/random/
then it will print a notice on the page. How do I stop the notice from showing up do I need to use something other than the list()
function?
Right now the notice is "Notice: Undefined offset: 1..."
Thanks for the help!