how to access class member with a dot in the name
Posted: Sat Nov 15, 2008 11:54 am
Hello
I am uploading an xml using simple_xml_load_file. The problem is that one of the data member has a dot in the name
For example I can do this
$obj->Part1->PensionReceivedPreviousYRS->Year OK
but I CANNOT DO
$obj->Part1->Less->B.TaxExempt->Year Error problem with dot.
What is the correct way?
I am uploading an xml using simple_xml_load_file. The problem is that one of the data member has a dot in the name
For example I can do this
$obj->Part1->PensionReceivedPreviousYRS->Year OK
but I CANNOT DO
$obj->Part1->Less->B.TaxExempt->Year Error problem with dot.
What is the correct way?
Code: Select all
SimpleXMLElement Object ( [CostAnnuity] => SimpleXMLElement Object ( ) [PensionReceivedPreviousYRS] => SimpleXMLElement Object ( [Year] => Array ( [0] => 2010 [1] => 2020 [2] => SimpleXMLElement Object ( ) [3] => SimpleXMLElement Object ( ) [4] => SimpleXMLElement Object ( ) ) [Amount] => Array ( [0] => 4 [1] => 6 [2] => SimpleXMLElement Object ( ) [3] => SimpleXMLElement Object ( ) [4] => SimpleXMLElement Object ( ) [5] => 10 ) ) [Less] => SimpleXMLElement Object ( [A.TaxablePension] => SimpleXMLElement Object ( [Year] => Array ( [0] => 3030 [1] => SimpleXMLElement Object ( ) [2] => SimpleXMLElement Object ( ) [3] => SimpleXMLElement Object ( ) [4] => SimpleXMLElement Object ( ) ) [Amount] => Array ( [0] => 23.67 [1] => SimpleXMLElement Object ( ) [2] => SimpleXMLElement Object ( ) [3] => SimpleXMLElement Object ( ) [4] => SimpleXMLElement Object ( ) [5] => 23.67 ) ) [B.TaxExempt] => SimpleXMLElement Object ( [Year] => Array ( [0] => 4040 [1] => SimpleXMLElement Object ( ) [2] => SimpleXMLElement Object ( ) [3] => SimpleXMLElement Object ( ) [4] => SimpleXMLElement Object ( ) ) [Amount] => Array ( [0] => 9090 [1] => SimpleXMLElement Object ( ) [2] => SimpleXMLElement Object ( ) [3] => SimpleXMLElement Object ( ) [4] => SimpleXMLElement Object ( ) [5] => 9090 ) ) ) [Total] => 9113.67 [CostPension] => 9103.67 [CostRecovered] => 9103.67 )