In my database, some field settings are serialized and stored. When I do this:
print_r(unserialized($r['settings']));
I'll get this:
Array (
[prefix] =>
[suffix] =>
[min] =>
[max] =>
[allowed_values] => 1|Common 2|Rare 3|Almost Extinct
)
I'm trying to create an array based on the values for allowed_values like this:
Array (
[1] => Common
[2] => Rare
[3] => Almost Extinct
)
The problem is, when I use explode("|", $r['allowed_values']), I get:
Array(
[0] => 1
[1] => Common 2
[2] => Rare 3
[3] => Almost Extinct
)
Which, makes sense, but obviously not what I was hoping for... So, I'm just wondering if there's a simple way to do what I'm trying here? I thought about using explode multiple times, once for spaces, and once for pipes, but that won't work either because of the space in "Almost Extinct"...