php - Single url variable with multiple values into array -
this question has answer here:
i have url single variable (category), variable has multiple values.
example: http://websiteurl.com/?category=cat+dog+rabbit+-cow
i'd generate array information.
<?$category[] = $_get['category'];?>
print_r reveals this:
$category = array ( [0] => cat dog rabbit -cow )
here's need like:
$category = array('cat','dog','rabbit','-cow');
have tried...
$categories = explode(' ', $_get['category']);
Comments
Post a Comment