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
Post a Comment