|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-04-21 22:22 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 21:00:01 2025 UTC |
Description: ------------ When i iterate a array that contains Objects asociated with a numeric key foreach statement changes the type of the variable from object to string then i can't access to the object methods but i can acces to its attributes. Reproduce code: --------------- foreach ($Resultados as $Clave=>$Objeto){ if($Clave!="Count" ||$Clave!="LegislaturaRomano"){ printf("<td class='tddatosazul'>%s</td>",$Objeto->denomiCorta); //Access to the object attribute printf("<td class='tddatosazul'>%s</td>",//access object's method here it fails $Objeto->getTotalInicitivasDictaminadas()); ... Expected result: ---------------- Display the result of the method getTotalInicitivasDictaminadas it only adds two values Actual result: -------------- Fatal error: Call to a member function on a non-object