Hi,

I'm getting an url variable from this test.php?ids=1,2,3

and need to transform it to

Array
(
    [0] => 1
    [1] => 8
    [2] => 9
)

What I've tried is : $ids = explode(', ', $_GET["ids"]);
but that gives me an array like this:

Array
(
    [0] => 1,8,9
)

Thankful for your help!

Recommended Answers

remove the space in the delimiter (right now you have ", " so change it to ",") and you should be good to go.

Jump to Post

All 2 Replies

remove the space in the delimiter (right now you have ", " so change it to ",") and you should be good to go.

That did it mate!

Cheers!!!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.