Reply to insert an element in numbered array

Your name:

Reply:


Posted by somaboy mx on 06/01/05 14:29

Hello,


I need to do the following:

Say I have a multidim array:

$array = array();

$array[0]['name'] = 'Kevin';
$array[0]['age'] = 23;

$array[1]['name'] = 'Julia';
$array[1]['age'] = 31;

$array[2]['name'] = 'Bob';
$array[2]['age'] = 26;

$array[3]['name'] = 'Drew';
$array[3]['age'] = 37;

and I have a seperate array:

$person = array();
$person['name'] = 'Dana';
$person['age'] = 33;

now I want to insert the $person array into the $array in such a way
that it ends up at index 1 and the subsequent elements get pushed up and
renumbered, so $array[1] becomes $array[2] and so on.

Does php have a built-in function that does this?


..soma

[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

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