joyacv2
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?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.