php - Accessing class element - a variable or array element? -


how access 14.95 here?

$object->{0} or $object[0] doesn't work

   simplexmlelement object     (         [@attributes] => array             (                 [currencyid] => usd             )          [0] => 14.95     ) 

interesting... if (int)$object->{0} works....

its bad practice have numbers properties of object. wouldn't named property easier maintain?

edit: thought wasn't possible looks , instead leaves code little ambiguous.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -