Jump to content

[SOLVED] Deleting an item from an array


Dale_G

Recommended Posts

hey, i was wondering if its possible to delete an item from an array?

 

$maybe = array( 'xx', 'xxx', 'x', 'abc', 'xxxxxx' );

 

How could I remove "abc" ($maybe[3]) from the array entirely so that the array would now look something like this:

 

 

$maybe = array( 'xx', 'xxx', 'x', 'xxxxxx' );

Link to comment
https://forums.phpfreaks.com/topic/133573-solved-deleting-an-item-from-an-array/
Share on other sites

Oops, I meant like where everything shifts over afterwards, so its as if it was never there and $maybe[3] could still be called, it would just be "xxxxxx" now.

 

Basically, delete one item from an array, and shift everything over so all the keys are preserved.

 

Sorry!

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.