Re: Re: [PHP-DEV] removing an item from an array

2012-08-18 Thread Morgan L. Owens
On 2012-08-19 04:08, Levi Morrison wrote: On Sat, Aug 18, 2012 at 12:42 AM, Alexey Zakhlestin wrote: On 16.08.2012, at 0:18, Rasmus Schultz wrote: How come there is no straight-foward obvious way to simply remove a given value from an array? Well, this sounds like a reason for creating Sp

Re: Re: [PHP-DEV] removing an item from an array

2012-08-15 Thread Sherif Ramadan
> > This is my favourite way of removing a value: > $kv = array( 1 => 'a', 2 => 'b', 3 => 'c'); > $vk = array_flip($kv); > unset($vk['b']); > $kv = array_flip($vk); That doesn't make any sense. What if the values are present more than once? array_flip will cause the keys to be overwritten. $arra

Re: Re: [PHP-DEV] removing an item from an array

2012-08-15 Thread Tyler L
On Wed, Aug 15, 2012 at 7:59 PM, Morgan L. Owens wrote: > On 2012-08-16 08:27, Nikita Popov wrote: > >> On Wed, Aug 15, 2012 at 10:22 PM, Stas Malyshev >> wrote: >> >>> Hi! >>> >>> How come there is no straight-foward obvious way to simply remove a given value from an array? Just

Re: Re: [PHP-DEV] removing an item from an array

2012-08-15 Thread Morgan L. Owens
On 2012-08-16 08:27, Nikita Popov wrote: On Wed, Aug 15, 2012 at 10:22 PM, Stas Malyshev wrote: Hi! How come there is no straight-foward obvious way to simply remove a given value from an array? Just look at the number of horrible ways people solve this obvious problem: I see: if(($key = ar