You are here: [SOLVED] Re: how to delete record in an array of arrays ? « PHP Language « IT news, forums, messages
[SOLVED] Re: how to delete record in an array of arrays ?

Posted by fabrice rιgnier on 02/15/07 15:38

ok, instead of

if($res['age']!=0) $filtered[] = $item;

i put

if($item['age']!=0) $filtered[] = $item;

and it rocks ;)

thanx,

f.

fabrice rΓ©gnier wrote:
> hi ;)
>
>> Either by a loop:
>> $filtered = array()
>> foreach ($res as $key => $item){
>> if($res['age']!=0) $filtered[] = $item;
>> //or preserve keys by $filtered[$key] = $item;
>> }
>>
>> Or indeed by array_filter:
>> $filtered = array_filter($res,create_funtion('$v,$k','return
>> $v['age']!=0;'));
>
> I've tested your 2 solutions and both doesn't work.
>
> First solution gives me an empty array as a result.
> Second solution gives me a syntaxic error.
>
> Maybe you forgot something ? Thanx, anyway.
>
> f.
>

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация