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

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -