Jump to content

split()


xbl1

Recommended Posts

Hi;i have problem to use the split(), i got a url value of string from the address bar.and i want to get the last part of the url value by using the split(), but i could not do it, could you help, please.the url value from the address bar format is;/shoppingand i want to take the "/" off and keep the remainsmy code as following;

<?php$category= $_SERVER['REQUEST_URI'];echo $category;list($cat)=split('[/]', $category);echo $cat;?>

echo $cat does not print out anything.

Link to comment
Share on other sites

You could do that with str_replace()

$cat = str_replace("/", "", $category);

With the split(), try

list($blank, $cat)=split('/', $category);

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...