Reply to Re: modifying an array

Your name:

Reply:


Posted by zebul0n on 08/06/07 14:44

> Maybe, you should try prepare own function, for example:
>
> $array = array('2' => '27584.10', '3' => '1008.00', '6' => 11393.55,
> '7' => 888.12);
>
> for ($i=0; $i<12; $i++){
> if (!array_key_exists($i)) $array[$i] = 0;
> }
>
> Regards,
> Marcin

Hello Marcin,

Thank you !

I was indeed using your solution but didn't know how to fill the empty
value.

Instead of using : $array[$i] = 0;
I was fighting with function like array_map. I was searching for
complication, because I wanted to fill the empty values at the right key
place.
Putting the values at the end of the array was the solution.

Now I just have to ksort() the array.

Thank you for your help and pointed me to the right direction.

Regards.

[Back to original 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

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация