3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = <<<XML <MembershipCardInfo><CardNo>8898990000000083</CardNo><MemberID>1144582</MemberID><PrintedName /><MembershipTypeCode>MSR</MembershipTypeCode><MembershipStatusCode>ACTIVE</MembershipStatusCode><MembershipPhoto>8898990000000083.jpg</MembershipPhoto><IssueDate>2014-09-15T00:00:00</IssueDate><EffectiveDate>2014-09-15T00:00:00</EffectiveDate><ExpiryDate>2015-09-15T00:00:00</ExpiryDate><Printed>false</Printed><PrintedDate xsi:nil="true" /><RenewedDate xsi:nil="true" /><tmpEffectiveDate xsi:nil="true" /><tmpExpiryDate xsi:nil="true" /><tmpMembershipStatusCode /><PointsBAL>0.0000</PointsBAL><Remarks /><MembershipDiscount>0</MembershipDiscount><TierCode>Welcome</TierCode><TotalSpending>0</TotalSpending><TotalNettSpending>0</TotalNettSpending><TotalPoints>0</TotalPoints><TotalVisits>0</TotalVisits><LastVisitedOutletCode /><MostCycleVisitedOutletCode>394</MostCycleVisitedOutletCode><TotalCycleVisits>0</TotalCycleVisits><TotalCycleSpending>0</TotalCycleSpending><TotalCycleNettSpending>0</TotalCycleNettSpending><TotalCyclePoints>0</TotalCyclePoints><TotalBalPoints>0</TotalBalPoints><CurrentMonthSpending>0</CurrentMonthSpending><CurrentMonth_1Spending>0</CurrentMonth_1Spending><CurrentMonth_2Spending>0</CurrentMonth_2Spending><CurrentMonthNettSpending>0</CurrentMonthNettSpending><CurrentMonth_1NettSpending>0</CurrentMonth_1NettSpending><CurrentMonth_2NettSpending>0</CurrentMonth_2NettSpending></MembershipCardInfo><MembershipCardInfo><CardNo>8898000000000260</CardNo><MemberID>1144582</MemberID><PrintedName>Test</PrintedName><MembershipTypeCode>MSR</MembershipTypeCode><MembershipStatusCode>ACTIVE</MembershipStatusCode><MembershipPhoto>Featured.jpg</MembershipPhoto><IssueDate>2014-09-19T00:00:00</IssueDate><EffectiveDate>2014-09-19T00:00:00</EffectiveDate><ExpiryDate>2017-09-20T00:00:00</ExpiryDate><Printed>false</Printed><PrintedDate xsi:nil="true" /><RenewedDate xsi:nil="true" /><tmpEffectiveDate xsi:nil="true" /><tmpExpiryDate xsi:nil="true" /><tmpMembershipStatusCode /><PointsBAL>0.0000</PointsBAL><Remarks /><MembershipDiscount>0</MembershipDiscount><TierCode>Unassigned</TierCode><TotalSpending>18.2</TotalSpending><TotalNettSpending>18</TotalNettSpending><TotalPoints>0</TotalPoints><TotalVisits>1</TotalVisits><LastVisitedOutletCode>394</LastVisitedOutletCode><MostCycleVisitedOutletCode /><TotalCycleVisits>1</TotalCycleVisits><TotalCycleSpending>18.2</TotalCycleSpending><TotalCycleNettSpending>18</TotalCycleNettSpending><TotalCyclePoints>0</TotalCyclePoints><TotalBalPoints>0</TotalBalPoints><CurrentMonthSpending>18.2</CurrentMonthSpending><CurrentMonth_1Spending>0</CurrentMonth_1Spending><CurrentMonth_2Spending>0</CurrentMonth_2Spending><CurrentMonthNettSpending>0</CurrentMonthNettSpending><CurrentMonth_1NettSpending>0</CurrentMonth_1NettSpending><CurrentMonth_2NettSpending>0</CurrentMonth_2NettSpending></MembershipCardInfo> XML; $xml = simplexml_load_string($x); $i = 0; foreach ($xml->MembershipCardInfo as $card): $cardArray[$i] = $card->CardNo; $i++; endforeach; foreach ($cardArray as $item) { echo $item.'<br />'; }

preferences:
45.63 ms | 402 KiB | 5 Q