Hi,
2012/8/22 Andrew Faulds :
> Um, Yasuo, have you looked at array_walk implementation and ascertained it
> is safe to change array structure while using it?
>
> Because I'm worried you're changing docs without doing so.
Simply deleting current element is safe.
It's done in everywhere in PHP. It
Um, Yasuo, have you looked at array_walk implementation and ascertained it is
safe to change array structure while using it?
Because I'm worried you're changing docs without doing so.
--
Sent from Samsung Mobile
Andrew Faulds
http://ajf.me/
Yasuo Ohgaki wrote:
Hi,
2012/8/22 Levi Morrison :
>
Hi,
2012/8/22 Levi Morrison :
> On Tue, Aug 21, 2012 at 7:45 PM, Yasuo Ohgaki wrote:
>>
>> Hi,
>>
>> 2012/8/16 Rasmus Schultz :
>> > 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
On Tue, Aug 21, 2012 at 7:45 PM, Yasuo Ohgaki wrote:
>
> Hi,
>
> 2012/8/16 Rasmus Schultz :
> > 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:
> >
> > http://stac
Hi,
2012/8/16 Rasmus Schultz :
> 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:
>
> http://stackoverflow.com/questions/7225070/php-array-delete-by-value-not-key
>
> Sho
I think adding more collection-types is the intuitive reaction to this
issue, but there's something to be said for the idea of having only a
single collection-type - I think that's one PHP feature we should not give
up.
Not having to pick and choose (and compromise) to select the "right"
collectio
Sorry for creating more "noise"...
Am 18.08.2012 06:59, schrieb Sherif Ramadan:
Further more, your assumption here that the result is incorrect (or
improperly indexed) is completely baseless and moot. You are making a
bold assumption that I both care about the keys and that I expect them
to be n
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
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 SplSet class
>
There's already SplO
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 SplSet class
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www
On Thu, Aug 16, 2012 at 2:39 AM, Lars Schultz wrote:
> Am 16.08.2012 07:55, schrieb Sherif Ramadan:
>
>> Now your array is something completely different from what you wanted.
>> The solution stated earlier is the most sane one (just using
>> array_keys() with a search value).
>
>
> the array_keys
Sherif Ramadan wrote:
I don't wish to degrade anyone's contributions to this thread, but
this really is the perfect example of making a lot of fuss over
nothing on the mailing list and an example of the kinds of discussion
we should be avoiding when there are so many other important problems
we c
On 2012-08-16 17:55, Sherif Ramadan wrote:
> That doesn't make any sense. What if the values are present more than
> once? array_flip will cause the keys to be overwritten.
>
Not to mention converting all of the array's elements to strings and/or
integers.
Now your array is something complete
Am 16.08.2012 07:55, schrieb Sherif Ramadan:
Now your array is something completely different from what you wanted.
The solution stated earlier is the most sane one (just using
array_keys() with a search value).
the array_keys solution is slower (although barely) than my suggested
array_slice
>
> 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
Am 15.08.2012 22:22, schrieb Stas Malyshev:
Just look at the number of horrible ways people solve this obvious problem:
I see:
if(($key = array_search($del_val, $messages)) !== false) {
unset($messages[$key]);
}
Nothing horrible here.
One thing that should be noted in this case and any s
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
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
On Wed, Aug 15, 2012 at 1:35 PM, Kris Craig wrote:
>
>
> On Wed, Aug 15, 2012 at 1:31 PM, Nikita Popov wrote:
>
>> On Wed, Aug 15, 2012 at 10:29 PM, Kris Craig
>> wrote:
>> >>
>> >> Btw, deleting all values (not just the first) is also very easy
>> currently:
>> >>
>> >> foreach (array_keys($arr
On Wed, Aug 15, 2012 at 1:31 PM, Nikita Popov wrote:
> On Wed, Aug 15, 2012 at 10:29 PM, Kris Craig wrote:
> >>
> >> Btw, deleting all values (not just the first) is also very easy
> currently:
> >>
> >> foreach (array_keys($array, $delValue) as $key) {
> >> unset($array[$key]);
> >> }
> >>
On Wed, Aug 15, 2012 at 10:29 PM, Kris Craig wrote:
>>
>> Btw, deleting all values (not just the first) is also very easy currently:
>>
>> foreach (array_keys($array, $delValue) as $key) {
>> unset($array[$key]);
>> }
>>
>
> Even easier still, just do this:
>
> $array_var = array();
It's ofte
>
>
> Btw, deleting all values (not just the first) is also very easy currently:
>
> foreach (array_keys($array, $delValue) as $key) {
> unset($array[$key]);
> }
>
>
Even easier still, just do this:
$array_var = array();
--Kris
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?
>
> The same reason there's no simple way to undefine variable whose value
> is 42 without knowing the variable name. Array is a conta
I like that chose 42 for the value. You win, and I completely agree.
On Wed, Aug 15, 2012 at 4:22 PM, Stas Malyshev wrote:
> Hi!
>
> > How come there is no straight-foward obvious way to simply remove a given
> > value from an array?
>
> The same reason there's no simple way to undefine variable
Hi!
> How come there is no straight-foward obvious way to simply remove a given
> value from an array?
The same reason there's no simple way to undefine variable whose value
is 42 without knowing the variable name. Array is a container indexed by
keys, not values. So if you've got just a value, t
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:
http://stackoverflow.com/questions/7225070/php-array-delete-by-value-not-key
Shouldn't we have something simple, like:
a
26 matches
Mail list logo