Re: ArrayObject - Posibillity to add key => value pair per default?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Did you try:

$a = new ArrayObject;
$a['sometest'] = 'somevalue';

?

On Wed, Jan 14, 2009 at 10:42 AM, Edmund Hertle <farnion@xxxxxxxxxxxxxx> wrote:
> Hey,
> I've just discovered the ArrayObject class, but it seems to not be well
> documented, so here is my problem:
>
> You can use ArrayObject::append() to add a new value to the array, but is
> there also a method to add a new key and value?
>
> And I know that I could extend the class and write my own method but isn't
> this quite a base method for arrays in php? So maybe I just missed a obvious
> point?
>
> Quick example:
>
> Without ArrayObject:
> 1. $array[] = $value
> 2. $array[$key] = $value
>
> With ArrayObject:
> 1. $arrayObject->append($value)
> 2. ???
>
> -eddy
>



-- 
Abraços
Edgar Ferreira da Silva
Engenheiro de Software
Campinas - SP
(19) 8110-0733
http://edgarfs.com.br
-----
Aprenda PHP, cole códigos, saiba das vagas de empregos:
http://www.manjaphp.com.br

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux