Hi,guys!May i know how to i seperate -keyword and +keyword from an array?


eg, i have $arrayList = array(+book,+school,-play,-study);

How to i seperate those +keyword into 1 array and -keyword into another array?


You help will be kindly appreciate.


Best Regards,
Stanley

Recommended Answers

You can use a foreach, an iterator, or array_walk.

Jump to Post

All 4 Replies

You can use a foreach, an iterator, or array_walk.

using preg_match with the +/- to seperate them together with the array_walk?

substr('+book', 0, 1) and substr('+book', 1) is much simpler to use.

Okay,i see.Thanks you very much for your value info.Appreciate it very much!

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.