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

2012-08-21 Thread Yasuo Ohgaki
2012/8/22 Yasuo Ohgaki : > Hi, > > 2012/8/22 Peter Cowburn : >> On 21 August 2012 23:26, Yasuo Ohgaki wrote: >>> array_walk is the best(fast and memory efficient) way >>> to delete elements. >> >> If array_walk() is the best (fast and memory efficient) way to delete >> elements, why have we had th

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

2012-08-21 Thread Yasuo Ohgaki
2012/8/22 Levi Morrison : >> Why did you change the equivalent code? >> array_walk is the best(fast and memory efficient) way >> to delete elements. >> >> This code may be refereed from old PHP users, therefore >> we should write better code. >> >> If you don' t have good reason to do so, please re

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

2012-08-21 Thread Yasuo Ohgaki
Hi, 2012/8/22 Peter Cowburn : > On 21 August 2012 23:26, Yasuo Ohgaki wrote: >> array_walk is the best(fast and memory efficient) way >> to delete elements. > > If array_walk() is the best (fast and memory efficient) way to delete > elements, why have we had the following line in the manual, for

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

2012-08-21 Thread Peter Cowburn
On 21 August 2012 23:26, Yasuo Ohgaki wrote: > array_walk is the best(fast and memory efficient) way > to delete elements. If array_walk() is the best (fast and memory efficient) way to delete elements, why have we had the following line in the manual, for the array_walk() callback, for over a de

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

2012-08-21 Thread Levi Morrison
> Why did you change the equivalent code? > array_walk is the best(fast and memory efficient) way > to delete elements. > > This code may be refereed from old PHP users, therefore > we should write better code. > > If you don' t have good reason to do so, please revert > the change. The implementa

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

2012-08-21 Thread Yasuo Ohgaki
Hi, 2012/8/22 Levi Morrison : > On Tue, Aug 21, 2012 at 4:13 PM, Yasuo Ohgaki wrote: >> Hi, >> >> I see why with new Criticism section in the wiki page. >> You've also misunderstood that array_udelete() is >> array_walk() variant, not array_filter(). >> > > Actually, array_udelete is far more sim

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

2012-08-21 Thread Yasuo Ohgaki
Hi, 2012/8/22 Levi Morrison : > On Tue, Aug 21, 2012 at 4:13 PM, Yasuo Ohgaki wrote: >> Hi, >> >> I see why with new Criticism section in the wiki page. >> You've also misunderstood that array_udelete() is >> array_walk() variant, not array_filter(). >> > > Actually, array_udelete is far more sim

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

2012-08-21 Thread Levi Morrison
On Tue, Aug 21, 2012 at 4:13 PM, Yasuo Ohgaki wrote: > Hi, > > I see why with new Criticism section in the wiki page. > You've also misunderstood that array_udelete() is > array_walk() variant, not array_filter(). > Actually, array_udelete is far more similar to array_filter than it is array_walk

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

2012-08-21 Thread Yasuo Ohgaki
Hi, I see why with new Criticism section in the wiki page. You've also misunderstood that array_udelete() is array_walk() variant, not array_filter(). This may be the good reason why we should have array_udelete :) Regards, -- Yasuo Ohgaki yohg...@ohgaki.net 2012/8/22 Yasuo Ohgaki : > 2012/8/

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

2012-08-21 Thread Yasuo Ohgaki
2012/8/22 Levi Morrison : > On Tue, Aug 21, 2012 at 3:45 PM, Andrew Faulds wrote: >> On 21/08/12 22:43, Levi Morrison wrote: >>> >>> There is a reason to have a callable provided: custom comparison. >>> Other array functions solve this by providing a `u` alternative: >>> >>> `int array_udelete(&$a

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

2012-08-21 Thread Levi Morrison
On Tue, Aug 21, 2012 at 3:45 PM, Andrew Faulds wrote: > On 21/08/12 22:43, Levi Morrison wrote: >> >> There is a reason to have a callable provided: custom comparison. >> Other array functions solve this by providing a `u` alternative: >> >> `int array_udelete(&$array, $value, bool function($value

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

2012-08-21 Thread Yasuo Ohgaki
Hi, 2012/8/22 Levi Morrison : > There is a reason to have a callable provided: custom comparison. > Other array functions solve this by providing a `u` alternative: > > `int array_udelete(&$array, $value, bool function($value, $key))` > > Let's not deviate from established array naming conventions

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

2012-08-21 Thread Andrew Faulds
On 21/08/12 22:43, Levi Morrison wrote: There is a reason to have a callable provided: custom comparison. Other array functions solve this by providing a `u` alternative: `int array_udelete(&$array, $value, bool function($value, $key))` Let's not deviate from established array naming convention

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

2012-08-21 Thread Levi Morrison
There is a reason to have a callable provided: custom comparison. Other array functions solve this by providing a `u` alternative: `int array_udelete(&$array, $value, bool function($value, $key))` Let's not deviate from established array naming conventions. (Yasuo, I'm looking at you) Cheers,

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

2012-08-21 Thread Andrew Faulds
On 21/08/12 22:35, Yasuo Ohgaki wrote: 2012/8/22 Andrew Faulds : On 21/08/12 22:18, Yasuo Ohgaki wrote: 2012/8/22 Andrew Faulds : Er, so you're advocating adding another method to do the same thing? Why? Because novices don't know about array_walk(). I think I've written this over and over in

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

2012-08-21 Thread Yasuo Ohgaki
2012/8/22 Andrew Faulds : > On 21/08/12 22:18, Yasuo Ohgaki wrote: >> >> 2012/8/22 Andrew Faulds : >>> >>> Er, so you're advocating adding another method to do the same thing? Why? >> >> Because novices don't know about array_walk(). >> I think I've written this over and over in this thread. > > So

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

2012-08-21 Thread Andrew Faulds
On 21/08/12 22:18, Yasuo Ohgaki wrote: 2012/8/22 Andrew Faulds : Er, so you're advocating adding another method to do the same thing? Why? Because novices don't know about array_walk(). I think I've written this over and over in this thread. So publicise array_walk() then. Don't add a new func

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

2012-08-21 Thread Yasuo Ohgaki
2012/8/22 Andrew Faulds : > Er, so you're advocating adding another method to do the same thing? Why? Because novices don't know about array_walk(). I think I've written this over and over in this thread. > The whole point of this was to allow people to use arrays like sets, or > easily remove li

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

2012-08-21 Thread Andrew Faulds
On 21/08/12 21:32, Yasuo Ohgaki wrote: 2012/8/22 Andrew Faulds : On 21/08/12 21:00, Yasuo Ohgaki wrote: Hi 2012/8/22 Andrew Faulds : On 21/08/12 10:36, Yasuo Ohgaki wrote: Int would be better and callable should be accepted like array_walk(). It's better to have array_delete_recursive(), too

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

2012-08-21 Thread Yasuo Ohgaki
2012/8/22 Andrew Faulds : > On 21/08/12 21:00, Yasuo Ohgaki wrote: >> >> Hi >> >> 2012/8/22 Andrew Faulds : >>> >>> On 21/08/12 10:36, Yasuo Ohgaki wrote: Int would be better and callable should be accepted like array_walk(). It's better to have array_delete_recursive(), too. I

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

2012-08-21 Thread Andrew Faulds
On 21/08/12 21:00, Yasuo Ohgaki wrote: Hi 2012/8/22 Andrew Faulds : On 21/08/12 10:36, Yasuo Ohgaki wrote: Int would be better and callable should be accepted like array_walk(). It's better to have array_delete_recursive(), too. I updated the page. Callable? What? This is to remove a single v

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

2012-08-21 Thread Yasuo Ohgaki
Hi 2012/8/22 Andrew Faulds : > On 21/08/12 10:36, Yasuo Ohgaki wrote: >> >> Int would be better and callable should be accepted like array_walk(). >> It's better to have array_delete_recursive(), too. >> I updated the page. > > Callable? What? This is to remove a single value, like a set. If you w

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

2012-08-21 Thread Andrew Faulds
On 21/08/12 10:36, Yasuo Ohgaki wrote: Hi 2012/8/21 Tjerk Anne Meesters : On Tue, Aug 21, 2012 at 10:31 AM, Rasmus Schultz wrote: Thank you, but this isn't really anything like what I had in mind. What I had in mind is more like set-semantics for arrays, e.g. designed to work with sets of d

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

2012-08-21 Thread Yasuo Ohgaki
Hi 2012/8/22 Levi Morrison : > On Tue, Aug 21, 2012 at 12:53 PM, Yasuo Ohgaki wrote: >> 2012/8/21 Levi Morrison : >>> >>> I'm against this RFC, but if you are going to even try to add >>> something, please keep it consistent! Don't modify `array_delete` to >>> take a callable, instead make a diff

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

2012-08-21 Thread Levi Morrison
On Tue, Aug 21, 2012 at 12:53 PM, Yasuo Ohgaki wrote: > 2012/8/21 Levi Morrison : >> >> I'm against this RFC, but if you are going to even try to add >> something, please keep it consistent! Don't modify `array_delete` to >> take a callable, instead make a different function `array_udelete` or >>

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

2012-08-21 Thread Yasuo Ohgaki
Hi, 2012/8/21 Levi Morrison : > On Tue, Aug 21, 2012 at 3:36 AM, Yasuo Ohgaki wrote: >> Hi >> >> 2012/8/21 Tjerk Anne Meesters : >>> On Tue, Aug 21, 2012 at 10:31 AM, Rasmus Schultz wrote: >>> Thank you, but this isn't really anything like what I had in mind. What I had in mind is

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

2012-08-21 Thread Levi Morrison
On Tue, Aug 21, 2012 at 3:36 AM, Yasuo Ohgaki wrote: > Hi > > 2012/8/21 Tjerk Anne Meesters : >> On Tue, Aug 21, 2012 at 10:31 AM, Rasmus Schultz wrote: >> >>> Thank you, but this isn't really anything like what I had in mind. >>> >>> What I had in mind is more like set-semantics for arrays, e.g.

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

2012-08-21 Thread Yasuo Ohgaki
Hi 2012/8/21 Tjerk Anne Meesters : > On Tue, Aug 21, 2012 at 10:31 AM, Rasmus Schultz wrote: > >> Thank you, but this isn't really anything like what I had in mind. >> >> What I had in mind is more like set-semantics for arrays, e.g. designed to >> work with sets of distinct values/objects. >> >>

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

2012-08-20 Thread Tjerk Anne Meesters
On Tue, Aug 21, 2012 at 10:31 AM, Rasmus Schultz wrote: > Thank you, but this isn't really anything like what I had in mind. > > What I had in mind is more like set-semantics for arrays, e.g. designed to > work with sets of distinct values/objects. > > Since I do not have permission to write on t

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

2012-08-20 Thread Levi Morrison
On Mon, Aug 20, 2012 at 8:47 PM, Levi Morrison wrote: > On Mon, Aug 20, 2012 at 8:31 PM, Rasmus Schultz wrote: >> Thank you, but this isn't really anything like what I had in mind. >> >> What I had in mind is more like set-semantics for arrays, e.g. designed to >> work with sets of distinct value

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

2012-08-20 Thread Levi Morrison
On Mon, Aug 20, 2012 at 8:31 PM, Rasmus Schultz wrote: > Thank you, but this isn't really anything like what I had in mind. > > What I had in mind is more like set-semantics for arrays, e.g. designed to > work with sets of distinct values/objects. > > Since I do not have permission to write on the

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

2012-08-20 Thread Rasmus Schultz
Thank you, but this isn't really anything like what I had in mind. What I had in mind is more like set-semantics for arrays, e.g. designed to work with sets of distinct values/objects. Since I do not have permission to write on the wiki, I posted an initial draft here: https://gist.github.com/32

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

2012-08-20 Thread Yasuo Ohgaki
Hi, 2012/8/21 Rasmus Schultz : > I have a login (mindplay) but I do not have permission to post or edit > anything on the wiki... I've created RFC for this https://wiki.php.net/rfc/array_delete Get wiki account and finish discussion. I may write patch for this with my spare time, but it may tak

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

2012-08-20 Thread Rasmus Schultz
I have a login (mindplay) but I do not have permission to post or edit anything on the wiki... On Mon, Aug 20, 2012 at 8:01 PM, Will Fitch wrote: > Please let this die until someone is serious enough to come up with an > rfc. This has been nothing but counterproductive arguing. If someone feels

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

2012-08-20 Thread Will Fitch
Please let this die until someone is serious enough to come up with an rfc. This has been nothing but counterproductive arguing. If someone feels strongly about it, write an rfc then we can discuss? On Aug 20, 2012 7:53 PM, "Yasuo Ohgaki" wrote: > Hi, > > 2012/8/21 Herman Radtke : > >>> May be we

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

2012-08-20 Thread Yasuo Ohgaki
Hi, 2012/8/21 Herman Radtke : >>> May be we should have something like >> >> >> >> >> array_delete_if($array, function($v, $k=null) { if ($v == 300) return >> >> true; }) >> > >> > So array_filter? >> >> I'll use it or like for deleting, but the point of this thread is >> "intuitive function for d

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

2012-08-20 Thread Levi Morrison
Also, `array_splice` will remove the index while modifying the array in-place. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

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

2012-08-20 Thread Andrew Faulds
On 20/08/12 19:05, Levi Morrison wrote: Some major points to consider for `array_delete`'s behavior: 1. Should items be compared with `==`, `===`, or custom comparison? If we use `==` or `===` we'd probably add `array_udelete` to allow a custom comparator. array_delete($array, $value, $all=fals

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

2012-08-20 Thread Levi Morrison
Some major points to consider for `array_delete`'s behavior: 1. Should items be compared with `==`, `===`, or custom comparison? If we use `==` or `===` we'd probably add `array_udelete` to allow a custom comparator. 2. Should it stop when it encounters the first value that matches? If it does, s

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

2012-08-20 Thread Andrew Faulds
On 20/08/12 18:43, Sebastian Krebs wrote: Am 20.08.2012 19:00, schrieb Andrew Faulds: On 20/08/12 17:47, Herman Radtke wrote: May be we should have something like array_delete_if($array, function($v, $k=null) { if ($v == 300) return true; }) So array_filter? I'll use it or like for deleting

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

2012-08-20 Thread Sebastian Krebs
Am 20.08.2012 19:00, schrieb Andrew Faulds: On 20/08/12 17:47, Herman Radtke wrote: May be we should have something like array_delete_if($array, function($v, $k=null) { if ($v == 300) return true; }) So array_filter? I'll use it or like for deleting, but the point of this thread is "intuitiv

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

2012-08-20 Thread Andrew Faulds
On 20/08/12 18:27, Levi Morrison wrote: You are basically asking to alias array_filter with "array_delete". That is a very slippery slope. I think array_filter is a very obvious choice to remove something from an array. The "filter" function/method is common in functional languages (and functiona

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

2012-08-20 Thread Levi Morrison
> You are basically asking to alias array_filter with "array_delete". That is > a very slippery slope. I think array_filter is a very obvious choice > to remove something from an array. The "filter" function/method is common > in functional languages (and functional frameworks like Underscore). Th

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

2012-08-20 Thread Andrew Faulds
On 20/08/12 18:11, Levi Morrison wrote: Adding array_delete would allow you to use it like a set more It's not a set and wasn't meant to be. If you want really bad set behavior, feel free to use an array as one. Arrays also aren't lists or associative arrays, strictly speaking. And there is a

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

2012-08-20 Thread Levi Morrison
> Adding array_delete would allow you to use it like a set more It's not a set and wasn't meant to be. If you want really bad set behavior, feel free to use an array as one. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

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

2012-08-20 Thread Andrew Faulds
On 20/08/12 17:47, Herman Radtke wrote: May be we should have something like array_delete_if($array, function($v, $k=null) { if ($v == 300) return true; }) So array_filter? I'll use it or like for deleting, but the point of this thread is "intuitive function for deleting element(s)" array_de

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

2012-08-20 Thread Herman Radtke
>> May be we should have something like > >> > >> array_delete_if($array, function($v, $k=null) { if ($v == 300) return > true; }) > > > > So array_filter? > > I'll use it or like for deleting, but the point of this thread is > "intuitive function for deleting element(s)" > > array_delete($array,

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

2012-08-20 Thread Rasmus Schultz
Absolutely, you're right. I have a tendency to get dragged into those. I apologize. On Fri, Aug 17, 2012 at 5:50 PM, Nikita Popov wrote: > > Could we please stop these pseudo-arguments?

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

2012-08-19 Thread Yasuo Ohgaki
2012/8/20 Andrew Faulds : > On 20/08/12 00:16, Yasuo Ohgaki wrote: >> >> 2012/8/20 Andrew Faulds : >>> >>> On 20/08/12 00:05, Yasuo Ohgaki wrote: 2012/8/20 Etienne Kneuss : > > On Sun, Aug 19, 2012 at 11:57 PM, Yasuo Ohgaki > wrote: >> >> 2012/8/18 Rasmus Lerdorf : >>

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

2012-08-19 Thread Andrew Faulds
On 20/08/12 00:16, Yasuo Ohgaki wrote: 2012/8/20 Andrew Faulds : On 20/08/12 00:05, Yasuo Ohgaki wrote: 2012/8/20 Etienne Kneuss : On Sun, Aug 19, 2012 at 11:57 PM, Yasuo Ohgaki wrote: 2012/8/18 Rasmus Lerdorf : On 08/17/2012 05:21 PM, Rasmus Schultz wrote: if(($key = array_search($del_val

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

2012-08-19 Thread Yasuo Ohgaki
2012/8/20 Andrew Faulds : > On 20/08/12 00:05, Yasuo Ohgaki wrote: >> >> 2012/8/20 Etienne Kneuss : >>> >>> On Sun, Aug 19, 2012 at 11:57 PM, Yasuo Ohgaki >>> wrote: 2012/8/18 Rasmus Lerdorf : > > On 08/17/2012 05:21 PM, Rasmus Schultz wrote: >>> >>> if(($key = array_sear

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

2012-08-19 Thread Andrew Faulds
On 20/08/12 00:05, Yasuo Ohgaki wrote: 2012/8/20 Etienne Kneuss : On Sun, Aug 19, 2012 at 11:57 PM, Yasuo Ohgaki wrote: 2012/8/18 Rasmus Lerdorf : On 08/17/2012 05:21 PM, Rasmus Schultz wrote: if(($key = array_search($del_val, $messages)) !== false) { unset($messages[$key]); } Nothing

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

2012-08-19 Thread Yasuo Ohgaki
2012/8/20 Etienne Kneuss : > On Sun, Aug 19, 2012 at 11:57 PM, Yasuo Ohgaki wrote: >> 2012/8/18 Rasmus Lerdorf : >>> On 08/17/2012 05:21 PM, Rasmus Schultz wrote: > > if(($key = array_search($del_val, $messages)) !== false) { > unset($messages[$key]); > } > > Nothing ho

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

2012-08-19 Thread Etienne Kneuss
On Sun, Aug 19, 2012 at 11:57 PM, Yasuo Ohgaki wrote: > 2012/8/18 Rasmus Lerdorf : >> On 08/17/2012 05:21 PM, Rasmus Schultz wrote: if(($key = array_search($del_val, $messages)) !== false) { unset($messages[$key]); } Nothing horrible here. >>> >>> I disagree

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

2012-08-19 Thread Yasuo Ohgaki
2012/8/18 Rasmus Lerdorf : > On 08/17/2012 05:21 PM, Rasmus Schultz wrote: >>> >>> if(($key = array_search($del_val, $messages)) !== false) { >>> unset($messages[$key]); >>> } >>> >>> Nothing horrible here. >>> >> >> I disagree - this is (or should be) a simple, atomic operation... >> yet, you'

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

2012-08-18 Thread Andrew Faulds
On 19/08/12 01:39, Morgan L. Owens wrote: On 2012-08-19 10:25, Andrew Faulds wrote: On 18/08/12 14:52, Morgan L. Owens wrote: How simple is it? Does it: 1) Remove one occurrence of the element (presumably the first) or all? 2) Reindex the array (as someone else argued was necessary to make it

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

2012-08-18 Thread Morgan L. Owens
On 2012-08-19 10:25, Andrew Faulds wrote: On 18/08/12 14:52, Morgan L. Owens wrote: How simple is it? Does it: 1) Remove one occurrence of the element (presumably the first) or all? 2) Reindex the array (as someone else argued was necessary to make it "properly indexed" afterwards) or not? 3) M

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

2012-08-18 Thread Andrew Faulds
On 18/08/12 14:52, Morgan L. Owens wrote: Rasmus Schultz wrote: > I disagree - this is (or should be) a simple, atomic operation... > yet, you've got a function-call, an intermediary variable, a boolean > test, and an unset statement repeating the name of the array you're > deleting from. > > Th

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

2012-08-18 Thread Andrew Faulds
On 17/08/12 22:41, Rasmus Lerdorf wrote: On 08/17/2012 05:35 PM, Rasmus Schultz wrote: Most other languages have more than one collection-type... since PHP has only the single, hybrid array-type which acts both as a hash and as an array, something like this ought to be available. I don't know w

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

2012-08-17 Thread Nikita Popov
On Fri, Aug 17, 2012 at 11:35 PM, Rasmus Schultz wrote: > Most other languages have more than one collection-type... since PHP has > only the single, hybrid array-type which acts both as a hash and as an > array, something like this ought to be available. > > I don't know why everyone is so eager

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

2012-08-17 Thread Rasmus Lerdorf
On 08/17/2012 05:35 PM, Rasmus Schultz wrote: > Most other languages have more than one collection-type... since PHP has > only the single, hybrid array-type which acts both as a hash and as an > array, something like this ought to be available. > > I don't know why everyone is so eager to jump up

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

2012-08-17 Thread Rasmus Schultz
Most other languages have more than one collection-type... since PHP has only the single, hybrid array-type which acts both as a hash and as an array, something like this ought to be available. I don't know why everyone is so eager to jump up and argue against something this simple, basic and usef

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

2012-08-17 Thread Rasmus Lerdorf
On 08/17/2012 05:21 PM, Rasmus Schultz wrote: >> >> if(($key = array_search($del_val, $messages)) !== false) { >> unset($messages[$key]); >> } >> >> Nothing horrible here. >> > > I disagree - this is (or should be) a simple, atomic operation... > yet, you've got a function-call, an intermediar