Link to home
Start Free TrialLog in
Avatar of joyacv2
joyacv2Flag for Puerto Rico

asked on

convert to array a value of a cell

i have a value from a database field named "possible status" like this:

01,02,03,04

I need to convert this to an array and then i need a code to find if a value exist in this array,

any idea?
ASKER CERTIFIED SOLUTION
Avatar of Chris Harte
Chris Harte
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Better yet, use in_array() instead of array_search. Identical to the above but will just return true or false rather than the key.
+1 for using in_array() instead of array_search().  Because PHP is loosely typed, an element found at position zero, would cause array_search() to return a value of zero, which is one of the "falsy" values that is often misinterpreted as equal (but not identical) to false.