3v4l.org

run code in 300+ PHP versions simultaneously
<?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++; } } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/5jkC8
function name:  (null)
number of ops:  72
compiled vars:  !0 = $data, !1 = $response, !2 = $res, !3 = $xml, !4 = $cardsArray, !5 = $cardsStatus, !6 = $counter, !7 = $child
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22utf-8%22%3F%3E%3CResponseXML+xmlns%3Axsd%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%22+xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance%22+xmlns%3D%22GenericVO.CardEnquiry%22%3E%3CReturnStatus%3E1%3C%2FReturnStatus%3E%3CReturnMessage%3ESUCCESS%3C%2FReturnMessage%3E%3CRequestTime%3E20150430151542%3C%2FRequestTime%3E%3CResponseTime%3E20150430151543%3C%2FResponseTime%3E%3CCardInfo%3E%3CCardNo%3E9999000000072720%3C%2FCardNo%3E%3CMemberID%3E2422732%3C%2FMemberID%3E%3CPrintedName%3EXiaoheng+Wang%3C%2FPrintedName%3E%3CMembershipTypeCode%3EMSR%3C%2FMembershipTypeCode%3E%3CMembershipStatusCode%3EACTIVE%3C%2FMembershipStatusCode%3E%3CMembershipPhoto+%2F%3E%3CIssueDate%3E2015-03-26T00%3A00%3A00%3C%2FIssueDate%3E%3CEffectiveDate%3E2015-03-26T00%3A00%3A00%3C%2FEffectiveDate%3E%3CExpiryDate%3E2016-03-26T00%3A00%3A00%3C%2FExpiryDate%3E%3CPrinted%3Efalse%3C%2FPrinted%3E%3CPrintedDate+xsi%3Anil%3D%22true%22+%2F%3E%3CRenewedDate+xsi%3Anil%3D%22true%22+%2F%3E%3CtmpEffectiveDate+xsi%3Anil%3D%22true%22+%2F%3E%3CtmpExpiryDate+xsi%3Anil%3D%22true%22+%2F%3E%3CtmpMembershipStatusCode+%2F%3E%3CPointsBAL%3E5.0000%3C%2FPointsBAL%3E%3CTotalPointsBAL%3E5.0000%3C%2FTotalPointsBAL%3E%3CHoldingPoints%3E0%3C%2FHoldingPoints%3E%3CRemarks+%2F%3E%3CMembershipDiscount+xsi%3Anil%3D%22true%22+%2F%3E%3CTierCode%3EWelcome%3C%2FTierCode%3E%3CLoyaltyMessage%3Efor-iCare-8898XXXXXXXXXXXX%3C%2FLoyaltyMessage%3E%3CDollarToPointsRatio+%2F%3E%3CRewardCycleLists%3E%3CRewardCycleInfo+Type%3D%22Current%22+Value%3D%225.0000%22+ExpiringDate%3D%222016-03-26T00%3A00%3A00%22+%2F%3E%3C%2FRewardCycleLists%3E%3CIsSupplementary%3Efalse%3C%2FIsSupplementary%3E%3CisBurnSupplementaryCard%3Efalse%3C%2FisBurnSupplementaryCard%3E%3CRelationID%3E188559A7-9B25-486A-9989-4F9D1EFA5771%3C%2FRelationID%3E%3CPrimaryCardNo+%2F%3E%3CPrimaryRelationID+%2F%3E%3CPrimaryCardExpiryDate+xsi%3Anil%3D%22true%22+%2F%3E%3CPrimaryCardEffectiveDate+xsi%3Anil%3D%22true%22+%2F%3E%3CPtsHoldingDays%3E0%3C%2FPtsHoldingDays%3E%3CPasscode%3E75310179+%3C%2FPasscode%3E%3CStoredValueBalance%3E0.0000%3C%2FStoredValueBalance%3E%3CCurrency+%2F%3E%3CLastVisitedDate%3E2015-04-26T00%3A00%3A00%3C%2FLastVisitedDate%3E%3CLastVisitedOutlet%3E518%3C%2FLastVisitedOutlet%3E%3CPointsToNextTier+%2F%3E%3CNettToNextTier+%2F%3E%3C%2FCardInfo%3E%3CMemberInfo%3E%3CMemberID%3E2422732%3C%2FMemberID%3E%3CSalutation+%2F%3E%3CName%3EXiaoheng+Wang%3C%2FName%3E%3CNRIC+%2F%3E%3CPassport+%2F%3E%3CEmail%3Ewangxiaoheng0319%40gmail.com%3C%2FEmail%3E%3CGender%3EF%3C%2FGender%3E%3CDOB%3E1992-03-19T00%3A00%3A00%3C%2FDOB%3E%3CNationality+%2F%3E%3CBlock+%2F%3E%3CLevel+%2F%3E%3CUnit+%2F%3E%3CStreet+%2F%3E%3CBuilding+%2F%3E%3CPostalCode+%2F%3E%3CCountry+%2F%3E%3CAddress1%3E+%3C%2FAddress1%3E%3CAddress2%3E+%3C%2FAddress2%3E%3CAddress3%3E+%3C%2FAddress3%3E%3CContactNo+%2F%3E%3CMobileNo%3E93585185%3C%2FMobileNo%3E%3CFaxNo+%2F%3E%3CReferrerCode+%2F%3E%3CFacebookID+%2F%3E%3CFacebookName+%2F%3E%3CFacebookPhotoLink+%2F%3E%3CFacebookToken+%2F%3E%3CFacebookTokenExpiry+%2F%3E%3CFullPhotoName+%2F%3E%3CBase64PhotoString+%2F%3E%3CPhotoLink+%2F%3E%3C%2FMemberInfo%3E%3CMembershipInfo%3E%3CTotalSpending%3E8.2%3C%2FTotalSpending%3E%3CTotalPoints%3E5%3C%2FTotalPoints%3E%3CTotalVisits%3E1%3C%2FTotalVisits%3E%3CLastVisitedOutletCode%3E518%3C%2FLastVisitedOutletCode%3E%3CMostCycleVisitedOutletCode%3E518%3C%2FMostCycleVisitedOutletCode%3E%3CTotalCycleVisits%3E1%3C%2FTotalCycleVisits%3E%3CTotalCycleSpending%3E8.2%3C%2FTotalCycleSpending%3E%3CTotalCyclePoints%3E5%3C%2FTotalCyclePoints%3E%3CTotalBalPoints%3E5%3C%2FTotalBalPoints%3E%3CCurrentMonthSpending%3E8.2%3C%2FCurrentMonthSpending%3E%3CCurrentMonth_1Spending%3E0%3C%2FCurrentMonth_1Spending%3E%3CCurrentMonth_2Spending%3E0%3C%2FCurrentMonth_2Spending%3E%3CTotalNettSpending%3E8.2%3C%2FTotalNettSpending%3E%3CTotalCycleNettSpending%3E8.2%3C%2FTotalCycleNettSpending%3E%3CCurrentMonthNettSpending%3E8.2%3C%2FCurrentMonthNettSpending%3E%3CCurrentMonth_1NettSpending%3E0%3C%2FCurrentMonth_1NettSpending%3E%3CCurrentMonth_2NettSpending%3E0%3C%2FCurrentMonth_2NettSpending%3E%3C%2FMembershipInfo%3E%3CTotalActiveVoucherCount%3E0%3C%2FTotalActiveVoucherCount%3E%3CVoucherLists+%2F%3E%3CReceiptMessage%3ECard+No+%3A+9999000000072720+Tier+%3A+Welcome+Stars+Awarded%3A+0+Stars+Balance%3A+5+Stored+Value+Balance%3A+0.0000+%3C%2FReceiptMessage%3E%3C%2FResponseXML%3E'
    5     1        INIT_FCALL                                               'htmlspecialchars_decode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $9      
          4        ASSIGN                                                   !1, $9
    9     5        INIT_FCALL                                               'preg_replace'
          6        SEND_VAL                                                 '%2Fxmlns%5B%5E%3D%5D%2A%3D%22%5B%5E%22%5D%2A%22%2Fi'
          7        SEND_VAL                                                 ''
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $11     
         10        ASSIGN                                                   !2, $11
   10    11        INIT_FCALL                                               'preg_replace'
         12        SEND_VAL                                                 '%2Fxsi%3Anil%3D%22true%22%2Fi'
         13        SEND_VAL                                                 ''
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                         $13     
         16        ASSIGN                                                   !2, $13
   12    17        INIT_FCALL                                               'simplexml_load_string'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                         $15     
         20        ASSIGN                                                   !3, $15
   13    21        FETCH_OBJ_R                                      ~17     !3, 'CardLists'
         22        ECHO                                                     ~17
         23      > EXIT                                                     
   14    24*       ASSIGN                                                   !4, <array>
   15    25*       ASSIGN                                                   !5, <array>
   17    26*       ASSIGN                                                   !6, 0
   18    27*       FETCH_OBJ_R                                      ~21     !3, 'CardLists'
         28*       INIT_METHOD_CALL                                         ~21, 'children'
         29*       DO_FCALL                                      0  $22     
         30*       FETCH_OBJ_R                                      ~23     $22, 'CardInfo'
         31*       FE_RESET_R                                       $24     ~23, ->70
         32*       FE_FETCH_R                                               $24, !7, ->70
   20    33*       FETCH_OBJ_R                                      ~25     !7, 'IsSupplementary'
         34*       IS_EQUAL                                                 ~25, 'false'
         35*       JMPZ                                                     ~26, ->57
   21    36*       FETCH_OBJ_R                                      ~29     !7, 'CardNo'
         37*       CAST                                          6  ~30     ~29
         38*       FETCH_W                      global              $27     '_SESSION'
         39*       ASSIGN_DIM                                               $27, 'MainCard'
         40*       OP_DATA                                                  ~30
   22    41*       FETCH_OBJ_R                                      ~33     !7, 'TierCode'
         42*       CAST                                          6  ~34     ~33
         43*       FETCH_W                      global              $31     '_SESSION'
         44*       ASSIGN_DIM                                               $31, 'TierCode'
         45*       OP_DATA                                                  ~34
   23    46*       FETCH_OBJ_R                                      ~37     !7, 'PointsToNextTier'
         47*       CAST                                          6  ~38     ~37
         48*       FETCH_W                      global              $35     '_SESSION'
         49*       ASSIGN_DIM                                               $35, 'PointsTier'
         50*       OP_DATA                                                  ~38
   24    51*       FETCH_OBJ_R                                      ~41     !7, 'IssueDate'
         52*       CAST                                          6  ~42     ~41
         53*       FETCH_W                      global              $39     '_SESSION'
         54*       ASSIGN_DIM                                               $39, 'IssueDate'
         55*       OP_DATA                                                  ~42
         56*       JMP                                                      ->69
   27    57*       FETCH_OBJ_R                                      ~43     !7, 'MembershipStatusCode'
         58*       IS_EQUAL                                                 ~43, 'ACTIVE'
         59*       JMPZ                                                     ~44, ->69
   28    60*       FETCH_OBJ_R                                      ~46     !7, 'CardNo'
         61*       CAST                                          6  ~47     ~46
         62*       ASSIGN_DIM                                               !4, !6
         63*       OP_DATA                                                  ~47
   29    64*       FETCH_OBJ_R                                      ~49     !7, 'MembershipStatusCode'
         65*       CAST                                          6  ~50     ~49
         66*       ASSIGN_DIM                                               !5, !6
         67*       OP_DATA                                                  ~50
   30    68*       PRE_INC                                                  !6
   18    69*       JMP                                                      ->32
         70*       FE_FREE                                                  $24
   33    71*     > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.86 ms | 1396 KiB | 19 Q