Re: [PHP] add item to end of (multidimensional) array

2004-10-15 Thread ApexEleven
How come you guys always go for the simplest answer? why not do something like,

$num = count($arrPt);
$arrPt[$num]['name'] = "Figntin' Bob";
$arrPt[$num]['address'] = "Under the Broad Street Bridge";

Live a little...

-Jasper


On Fri, 15 Oct 2004 09:07:43 -0500, Chris Boget <[EMAIL PROTECTED]> wrote:
> > You mean like this...
> > $sub = array
> > (
> > 'name' => 'Ahnold',
> > 'address' => '123 Someplace Nice',
> > );
> >
> > $bigArray[] = $sub;
> 
> Something else that will work is the following:
> 
> $arrPt =& $Arr[];
> $arrPt['name'] = 'bob';
> $arrPt['address'] = 'wherever';
> 
> thnx,
> Chris
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
<<
Jasper Howard - Database Administration
ApexEleven.com
530 559 0107
--->>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] add item to end of (multidimensional) array

2004-10-15 Thread Chris Boget
> You mean like this...
> $sub = array
> (
> 'name' => 'Ahnold',
> 'address' => '123 Someplace Nice',
> );
> 
> $bigArray[] = $sub;

Something else that will work is the following:

$arrPt =& $Arr[];
$arrPt['name'] = 'bob';
$arrPt['address'] = 'wherever';

thnx,
Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] add item to end of (multidimensional) array

2004-10-15 Thread Chris Dowell
try $Arr[] = array('name' => 'arnold', 'address' => 'street');
Arnold wrote:
Hi,
How can i add new items to an array without using an index.
Normally (single dimension) you can do:  Arr[]="x" and this item is
added to the array, but what if i have subitems like:
Arr[]['name']="arnold"; Arr[]['address']="street".
This last example doesnt work and i think there will be an easy solution but
who can tell me this?
Arnold
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] add item to end of (multidimensional) array

2004-10-15 Thread Robert Cummings
On Fri, 2004-10-15 at 08:34, Arnold wrote:
> Hi,
> 
> How can i add new items to an array without using an index.
> Normally (single dimension) you can do:  Arr[]="x" and this item is
> added to the array, but what if i have subitems like:
> Arr[]['name']="arnold"; Arr[]['address']="street".
> This last example doesnt work and i think there will be an easy solution but
> who can tell me this?

You mean like this...

$sub = array
(
'name' => 'Ahnold',
'address' => '123 Someplace Nice',
);

$bigArray[] = $sub;

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] add item to end of (multidimensional) array

2004-10-15 Thread Arnold
Hi,

How can i add new items to an array without using an index.
Normally (single dimension) you can do:  Arr[]="x" and this item is
added to the array, but what if i have subitems like:
Arr[]['name']="arnold"; Arr[]['address']="street".
This last example doesnt work and i think there will be an easy solution but
who can tell me this?

Arnold

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php