You are here: Re: Inserting into an array... « PHP Programming Language « IT news, forums, messages
Re: Inserting into an array...

Posted by Erwin Moller on 03/23/07 13:45

Sonnich wrote:

> Hi
>
> if I have an array of [a, b, d] and want to insert c, what is the way
> then?
>
> Sonnich

$testArr = array('a','b','d');
// one of the 1000 ways to manipulate an array in PHP:
$testArr[] = 'c';
// [] without a number or string means just add at the end

// results in an array 'a','b','d','c'

If you want to sort it, use sort() or usort() if you need anything fancy.

Regards,
Erwin Moller

 

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

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