Jump to content

[SOLVED] An Array Question


mark-unna

Recommended Posts

Hi all

 

I think I'm being a idiot here, but my head has gone blank on the following.

 

I have an array with words in it, such as:

 

$fruits = array('Apple', 'Banana', 'Clementine', 'Damson' ...)

 

Now how do I remove a specific array value if I don't know its key? For example, I don't know where Damson sits in the array (assume I have hundreds of elements in the array), so how do I remove it without knowing its index?

 

Ideally I just want to:

 

unset($fruits['Damson']), but this doesn't work.

 

I know it's an obvious one, but after a good while of googling, I just can't find the answer! Help!

 

Link to comment
https://forums.phpfreaks.com/topic/85523-solved-an-array-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.