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

javascript - Create websocket without connecting -

how to do line continuation in perl debugger for entering raw multi-line text (EOT)? -

Android SDK Manager freezes after installation of OSX 10.11 El Capitan public Beta -