3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml = '<OperatingProfile> <RegularDayType> <DaysOfWeek> <Tuesday /> <Wednesday /> <Thursday /> <Friday /> </DaysOfWeek> </RegularDayType> <SpecialDaysOperation> <DaysOfNonOperation> <DateRange> <StartDate>2015-12-24</StartDate> <EndDate>2016-01-01</EndDate> </DateRange> </DaysOfNonOperation> </SpecialDaysOperation> <BankHolidayOperation> <DaysOfNonOperation> <AllBankHolidays /> </DaysOfNonOperation> </BankHolidayOperation> </OperatingProfile>'; $simpleXML = simplexml_load_string($xml); $stuff = $simpleXML->{'BankHolidayOperation'}->{'DaysOfNonOperation'}->xpath('//*'); print_r($stuff);
based on vQjiQ
Output for 5.3.19 - 5.3.29, 5.5.27 - 5.5.35, 5.6.11 - 7.2.0
Array ( [0] => SimpleXMLElement Object ( [RegularDayType] => SimpleXMLElement Object ( [DaysOfWeek] => SimpleXMLElement Object ( [Tuesday] => SimpleXMLElement Object ( ) [Wednesday] => SimpleXMLElement Object ( ) [Thursday] => SimpleXMLElement Object ( ) [Friday] => SimpleXMLElement Object ( ) ) ) [SpecialDaysOperation] => SimpleXMLElement Object ( [DaysOfNonOperation] => SimpleXMLElement Object ( [DateRange] => SimpleXMLElement Object ( [StartDate] => 2015-12-24 [EndDate] => 2016-01-01 ) ) ) [BankHolidayOperation] => SimpleXMLElement Object ( [DaysOfNonOperation] => SimpleXMLElement Object ( [AllBankHolidays] => SimpleXMLElement Object ( ) ) ) ) [1] => SimpleXMLElement Object ( [DaysOfWeek] => SimpleXMLElement Object ( [Tuesday] => SimpleXMLElement Object ( ) [Wednesday] => SimpleXMLElement Object ( ) [Thursday] => SimpleXMLElement Object ( ) [Friday] => SimpleXMLElement Object ( ) ) ) [2] => SimpleXMLElement Object ( [Tuesday] => SimpleXMLElement Object ( ) [Wednesday] => SimpleXMLElement Object ( ) [Thursday] => SimpleXMLElement Object ( ) [Friday] => SimpleXMLElement Object ( ) ) [3] => SimpleXMLElement Object ( ) [4] => SimpleXMLElement Object ( ) [5] => SimpleXMLElement Object ( ) [6] => SimpleXMLElement Object ( ) [7] => SimpleXMLElement Object ( [DaysOfNonOperation] => SimpleXMLElement Object ( [DateRange] => SimpleXMLElement Object ( [StartDate] => 2015-12-24 [EndDate] => 2016-01-01 ) ) ) [8] => SimpleXMLElement Object ( [DateRange] => SimpleXMLElement Object ( [StartDate] => 2015-12-24 [EndDate] => 2016-01-01 ) ) [9] => SimpleXMLElement Object ( [StartDate] => 2015-12-24 [EndDate] => 2016-01-01 ) [10] => SimpleXMLElement Object ( [0] => 2015-12-24 ) [11] => SimpleXMLElement Object ( [0] => 2016-01-01 ) [12] => SimpleXMLElement Object ( [DaysOfNonOperation] => SimpleXMLElement Object ( [AllBankHolidays] => SimpleXMLElement Object ( ) ) ) [13] => SimpleXMLElement Object ( [AllBankHolidays] => SimpleXMLElement Object ( ) ) [14] => SimpleXMLElement Object ( ) )
Output for 5.4.9 - 5.5.26, 5.6.8 - 5.6.10
Array ( [0] => SimpleXMLElement Object ( [RegularDayType] => SimpleXMLElement Object ( [DaysOfWeek] => SimpleXMLElement Object ( [Tuesday] => SimpleXMLElement Object ( ) [Wednesday] => SimpleXMLElement Object ( ) [Thursday] => SimpleXMLElement Object ( ) [Friday] => SimpleXMLElement Object ( ) ) ) [SpecialDaysOperation] => SimpleXMLElement Object ( [DaysOfNonOperation] => SimpleXMLElement Object ( [DateRange] => SimpleXMLElement Object ( [StartDate] => 2015-12-24 [EndDate] => 2016-01-01 ) ) ) [BankHolidayOperation] => SimpleXMLElement Object ( [DaysOfNonOperation] => SimpleXMLElement Object ( [AllBankHolidays] => SimpleXMLElement Object ( ) ) ) ) [1] => SimpleXMLElement Object ( [DaysOfWeek] => SimpleXMLElement Object ( [Tuesday] => SimpleXMLElement Object ( ) [Wednesday] => SimpleXMLElement Object ( ) [Thursday] => SimpleXMLElement Object ( ) [Friday] => SimpleXMLElement Object ( ) ) ) [2] => SimpleXMLElement Object ( [Tuesday] => SimpleXMLElement Object ( ) [Wednesday] => SimpleXMLElement Object ( ) [Thursday] => SimpleXMLElement Object ( ) [Friday] => SimpleXMLElement Object ( ) ) [3] => SimpleXMLElement Object ( ) [4] => SimpleXMLElement Object ( ) [5] => SimpleXMLElement Object ( ) [6] => SimpleXMLElement Object ( ) [7] => SimpleXMLElement Object ( [DaysOfNonOperation] => SimpleXMLElement Object ( [DateRange] => SimpleXMLElement Object ( [StartDate] => 2015-12-24 [EndDate] => 2016-01-01 ) ) ) [8] => SimpleXMLElement Object ( [DateRange] => SimpleXMLElement Object ( [StartDate] => 2015-12-24 [EndDate] => 2016-01-01 ) ) [9] => SimpleXMLElement Object ( [StartDate] => 2015-12-24 [EndDate] => 2016-01-01 ) [10] => SimpleXMLElement Object ( ) [11] => SimpleXMLElement Object ( ) [12] => SimpleXMLElement Object ( [DaysOfNonOperation] => SimpleXMLElement Object ( [AllBankHolidays] => SimpleXMLElement Object ( ) ) ) [13] => SimpleXMLElement Object ( [AllBankHolidays] => SimpleXMLElement Object ( ) ) [14] => SimpleXMLElement Object ( ) )