Re: Iterate sobre Objectos para saber la cantidad
| From: | Julio Araya | Date: | Thu, 21 Aug 2008 15:42:56 +0000 |
| Subject: | Re: Iterate sobre Objectos para saber la cantidad | ||
| References: | 1 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-63054@lists.php.net to get a copy of this message | ||
2008/8/21 Carlos Medina <info@simply-networks.de>:
> Buenas Tardes,
> necesito saber la cantidad de attributes en una cantidad dada de objetos:
>
> Array
> (
> [0] => Object
> ( [attr] => test
> [attr2]=> test2
> )
> [1] => Object
> ( [attr] => test_a
> [attr2]=> test2
> )
> [2] => Object
> ( [attr] => test
> [attr2]=> test2
> )
> )
>
> Por ejemplo aqui necesitaria saber cuantos "attr" (no "attr2"), con value
> test existen en los tres objetos y cuantos existen con value test_a
>
> Se les ocurre algo?
>
Puedes probar con una mezcla de array_count_values y array_walk
http://cl2.php.net/manual/en/function.array-count-values.php
http://cl2.php.net/manual/en/function.array-walk.php
saludos!
> Saludos
>
> Carlos
>
> --
> PHP Spanish Localization Talk Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Julio Araya C. Linux User #386141
Estudiante de Ingeniería Civil Informática Ubuntu User #14778
Universidad Técnica Federico Santa María Valparaíso - Chile
http://www.delpho.cl