3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $data = '<?xml version="1.0" encoding="utf-8"?><ResponseXML xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="GenericVO.CardEnquiry"><ReturnStatus>1</ReturnStatus><ReturnMessage>SUCCESS</ReturnMessage><RequestTime>20150430151542</RequestTime><ResponseTime>20150430151543</ResponseTime><CardInfo><CardNo>9999000000072720</CardNo><MemberID>2422732</MemberID><PrintedName>Xiaoheng Wang</PrintedName><MembershipTypeCode>MSR</MembershipTypeCode><MembershipStatusCode>ACTIVE</MembershipStatusCode><MembershipPhoto /><IssueDate>2015-03-26T00:00:00</IssueDate><EffectiveDate>2015-03-26T00:00:00</EffectiveDate><ExpiryDate>2016-03-26T00:00:00</ExpiryDate><Printed>false</Printed><PrintedDate xsi:nil="true" /><RenewedDate xsi:nil="true" /><tmpEffectiveDate xsi:nil="true" /><tmpExpiryDate xsi:nil="true" /><tmpMembershipStatusCode /><PointsBAL>5.0000</PointsBAL><TotalPointsBAL>5.0000</TotalPointsBAL><HoldingPoints>0</HoldingPoints><Remarks /><MembershipDiscount xsi:nil="true" /><TierCode>Welcome</TierCode><LoyaltyMessage>for-iCare-8898XXXXXXXXXXXX</LoyaltyMessage><DollarToPointsRatio /><RewardCycleLists><RewardCycleInfo Type="Current" Value="5.0000" ExpiringDate="2016-03-26T00:00:00" /></RewardCycleLists><IsSupplementary>false</IsSupplementary><isBurnSupplementaryCard>false</isBurnSupplementaryCard><RelationID>188559A7-9B25-486A-9989-4F9D1EFA5771</RelationID><PrimaryCardNo /><PrimaryRelationID /><PrimaryCardExpiryDate xsi:nil="true" /><PrimaryCardEffectiveDate xsi:nil="true" /><PtsHoldingDays>0</PtsHoldingDays><Passcode>75310179 </Passcode><StoredValueBalance>0.0000</StoredValueBalance><Currency /><LastVisitedDate>2015-04-26T00:00:00</LastVisitedDate><LastVisitedOutlet>518</LastVisitedOutlet><PointsToNextTier /><NettToNextTier /></CardInfo><MemberInfo><MemberID>2422732</MemberID><Salutation /><Name>Xiaoheng Wang</Name><NRIC /><Passport /><Email>wangxiaoheng0319@gmail.com</Email><Gender>F</Gender><DOB>1992-03-19T00:00:00</DOB><Nationality /><Block /><Level /><Unit /><Street /><Building /><PostalCode /><Country /><Address1> </Address1><Address2> </Address2><Address3> </Address3><ContactNo /><MobileNo>93585185</MobileNo><FaxNo /><ReferrerCode /><FacebookID /><FacebookName /><FacebookPhotoLink /><FacebookToken /><FacebookTokenExpiry /><FullPhotoName /><Base64PhotoString /><PhotoLink /></MemberInfo><MembershipInfo><TotalSpending>8.2</TotalSpending><TotalPoints>5</TotalPoints><TotalVisits>1</TotalVisits><LastVisitedOutletCode>518</LastVisitedOutletCode><MostCycleVisitedOutletCode>518</MostCycleVisitedOutletCode><TotalCycleVisits>1</TotalCycleVisits><TotalCycleSpending>8.2</TotalCycleSpending><TotalCyclePoints>5</TotalCyclePoints><TotalBalPoints>5</TotalBalPoints><CurrentMonthSpending>8.2</CurrentMonthSpending><CurrentMonth_1Spending>0</CurrentMonth_1Spending><CurrentMonth_2Spending>0</CurrentMonth_2Spending><TotalNettSpending>8.2</TotalNettSpending><TotalCycleNettSpending>8.2</TotalCycleNettSpending><CurrentMonthNettSpending>8.2</CurrentMonthNettSpending><CurrentMonth_1NettSpending>0</CurrentMonth_1NettSpending><CurrentMonth_2NettSpending>0</CurrentMonth_2NettSpending></MembershipInfo><TotalActiveVoucherCount>0</TotalActiveVoucherCount><VoucherLists /><ReceiptMessage>Card No : 9999000000072720 Tier : Welcome Stars Awarded: 0 Stars Balance: 5 Stored Value Balance: 0.0000 </ReceiptMessage></ResponseXML>'; $response = htmlspecialchars_decode($data); //echo $response;exit; $res = preg_replace('/xmlns[^=]*="[^"]*"/i', '', $response); // remove all namespaces $res = preg_replace('/xsi:nil="true"/i', '', $res); // remove all xsi:nil="true" $xml = simplexml_load_string($res); echo $xml->CardLists;exit; $cardsArray = array(); $cardsStatus = array(); $counter = 0; foreach ($xml->CardLists->children()->CardInfo as $child) { // primary card, IsSupplementary == false if ($child->IsSupplementary == 'false') { $_SESSION['MainCard'] = (string) $child->CardNo; $_SESSION['TierCode'] = (string) $child->TierCode; $_SESSION["PointsTier"] = (string) $child->PointsToNextTier; $_SESSION["IssueDate"] = (string) $child->IssueDate; } else { //get supp cards if ($child->MembershipStatusCode == 'ACTIVE') { $cardsArray[$counter] = (string) $child->CardNo; $cardsStatus[$counter] = (string) $child->MembershipStatusCode; $counter++; } } }
based on TkIRJ

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.2.00.0120.00920.00
7.1.200.0100.00316.13
7.1.100.0030.01018.75
7.1.70.0000.01017.51
7.1.60.0070.01719.50
7.1.50.0100.01417.44
7.1.00.0030.07722.61
7.0.200.0190.00616.70
7.0.140.0100.05722.18
7.0.60.0100.08320.09
7.0.50.0200.06018.01
7.0.40.0130.08720.44
7.0.30.0200.04720.45
7.0.20.0270.09020.31
7.0.10.0200.06720.33
7.0.00.0070.08720.24
5.6.280.0000.07721.04
5.6.210.0100.08020.72
5.6.200.0100.05018.30
5.6.190.0130.06020.79
5.6.180.0170.05320.48
5.6.170.0370.06320.59
5.6.160.0070.07020.59
5.6.150.0030.08018.30
5.6.140.0100.04018.25
5.6.130.0130.07318.29
5.6.120.0100.08321.07
5.6.110.0030.07321.07
5.6.100.0130.07721.10
5.6.90.0100.05721.07
5.6.80.0100.03320.59
5.6.70.4370.03320.48
5.5.350.0130.09020.61
5.5.340.0100.03718.04
5.5.330.0070.06720.69
5.5.320.0100.06720.20
5.5.310.0330.07720.36
5.5.300.0030.05018.08
5.5.290.0030.07718.10
5.5.280.0100.08020.94
5.5.270.0030.04721.15
5.5.260.0030.08720.94
5.5.250.0100.07020.86
5.5.240.0030.07020.22
5.4.450.3830.03719.69
5.4.440.3700.04019.36
5.4.430.3770.04319.53
5.4.420.3830.04019.67
5.4.410.3870.03319.57
5.4.400.4200.03719.35
5.4.390.3800.04019.21
5.4.380.4800.03319.11
5.4.370.0770.04319.38
5.4.360.0000.04719.08
5.4.350.3870.04019.11
5.4.340.3930.03319.21
5.4.320.3630.03319.28
5.4.310.3730.03719.35
5.4.300.3500.04719.20
5.4.290.3800.03319.11
5.4.280.3770.03319.21
5.4.270.2300.04019.17
5.4.260.0000.06319.00
5.4.250.3800.03719.05
5.4.240.2270.03019.27
5.4.230.2930.03719.36
5.4.220.3530.02719.00
5.4.210.3400.03719.34
5.4.200.3370.03319.28
5.4.190.3270.03319.20
5.4.180.4000.03719.24
5.4.170.3170.04019.34
5.4.160.3900.03319.02
5.4.150.3870.03719.30
5.4.140.3200.03716.47
5.4.130.3770.03716.62
5.4.120.3830.03716.62
5.4.110.3870.04016.67
5.4.100.4200.04016.68
5.4.90.3870.03716.64
5.4.80.3700.03016.55
5.4.70.4070.04016.58
5.4.60.3670.03316.63
5.4.50.4030.04016.58
5.4.40.4170.03716.61
5.4.30.4300.02716.62
5.4.20.4200.04016.37
5.4.10.3900.03316.61
5.4.00.3930.03716.07
5.3.290.3900.04314.74
5.3.280.3500.04714.59
5.3.270.3270.04314.61
5.3.260.3870.04014.67
5.3.250.3800.03714.71
5.3.240.3800.03714.66
5.3.230.3830.04014.65
5.3.220.3830.03714.82
5.3.210.3830.03314.67
5.3.200.4730.03014.63
5.3.190.3830.04014.78
5.3.180.3800.04314.62
5.3.170.3970.04014.57
5.3.160.3830.04014.62
5.3.150.3630.03314.64
5.3.140.3870.04014.62
5.3.130.3930.03714.61
5.3.120.3770.04014.57
5.3.110.3630.03014.61
5.3.100.3870.03714.07
5.3.90.3930.03014.13
5.3.80.3570.04014.08
5.3.70.3900.02713.97
5.3.60.3930.03714.07
5.3.50.3600.03314.16
5.3.40.3600.03714.05
5.3.30.4230.03714.12
5.3.20.4600.03713.89
5.3.10.4130.04313.73
5.3.00.3830.03713.57
5.2.170.3030.02311.20
5.2.160.3430.03011.32
5.2.150.3300.02711.21
5.2.140.3370.02711.32
5.2.130.3330.02311.16
5.2.120.3500.03311.23
5.2.110.3530.02711.16
5.2.100.3030.03011.31
5.2.90.3230.03011.09
5.2.80.3470.02711.11
5.2.70.3330.02711.27
5.2.60.3230.03011.14
5.2.50.3130.02711.07
5.2.40.2670.02711.05
5.2.30.2630.02711.22
5.2.20.2500.02711.12
5.2.10.2600.03010.98
5.2.00.2630.02710.84
5.1.60.1930.02310.10
5.1.50.2670.02310.07
5.1.40.2570.02310.27
5.1.30.2670.02710.48
5.1.20.2600.02710.45
5.1.10.2800.02710.20
5.1.00.2670.02310.18
5.0.50.1530.01710.07
5.0.40.1430.02010.07
5.0.30.1400.03010.07
5.0.20.1500.02710.07
5.0.10.1400.02310.07
5.0.00.1170.03310.07
4.4.90.1430.02010.07
4.4.80.1370.01310.07
4.4.70.1370.02010.07
4.4.60.1500.02010.07
4.4.50.1430.01310.07
4.4.40.1370.02710.07
4.4.30.1400.01710.07
4.4.20.1300.02310.07
4.4.10.1430.01310.07
4.4.00.1430.03010.07
4.3.110.1430.01310.07
4.3.100.1400.01710.07
4.3.90.1400.01710.07
4.3.80.1500.03010.07
4.3.70.1330.01710.07
4.3.60.1630.01710.07
4.3.50.1400.02010.07
4.3.40.1400.02310.07
4.3.30.0670.02010.07
4.3.20.0870.02010.07
4.3.10.0630.01310.07
4.3.00.0600.01310.07