Removing an element from an array

In an entry in a mySQL database table I have a field that is numbers separated by commas … let’s say ‘8, 3, 5’… what would be the smartest way to remove in this example ‘3’? I’m thinking it’s better doing this with arrays and somehow pushing it to the end of the array and then popping it as you might in actionscript but from what I understand of the push function in PHP it only adds new elements onto the end of the array rather than moving existing elements to the end.

can anyone suggest the way forward?

_with thanks

explode() the string

unset() the array index

implode() back together

use array_search() if you need to find the index

–consider normalizing the table so you don’t have such multivalued columns

that was exactly the type of reply I was hoping for - thanks crmalibu

  • just to let you know that is was a choice between many many entries or multivalued columns <

_thanks again