3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<XML <findit xmlns="http://www.URL.COM" version="8" type="TIX" date="20160323"> <account code="XXXXXX"> <customers> <customer code="12345"> <status code="0">Success</status> <logistic-jobs> <logistic-job id="12345" date="20160324" status="PLA" modified="201603231420"> <number> <number1>479599</number1> <number3>11221</number3> </number> <collection date="20160324" time="0500"> <name>JOHN SMITH</name> <address1>UNIT 3 DAVEY ROAD</address1> <address2>FIELDS END BUSINESS PARK</address2> <address3>GOLDTHORPE</address3> <address4>ROTHERHAM</address4> <address5>S63 0JF</address5> </collection> <delivery date="20160324" time="1200"> <address1>EXAMPLE</address1> <address2>GLENEAFLES FARM</address2> <address3>GLENEAGLES CLOSE</address3> <address4>STANWELL, MIDDLESEX</address4> <address5>TW19 7PD</address5> </delivery> <extra> <address1>45FT C/SIDER</address1> <address2>No</address2> <address4>CEMENT</address4> </extra> <drivers> <driver code="TM1">DAVE SMITH (DAYS)</driver> </drivers> <load weight="27600.00" volume="0.00"> <pallets full="23" half="0" quarter="0" blue="0" oversize="0"/> </load> </logistic-job> </logistic-jobs> </customer> </customers> </account> </findit> XML; $job_simple = simplexml_load_string($xml); if(isset($job_simple->account->customers->customer)) { // Foreach customer in array foreach($job_simple->account->customers->customer as $i => $customer) { // If status is set to success if((string)$customer->status == "Success") { // For each job foreach($customer->{'logistic-jobs'}->{'logistic-job'} as $i => $job) { echo "<ul>\n"; foreach ( $job->drivers->driver as $driver ) { echo "<li> {$driver['code']}: $driver\n"; } echo "</ul>\n"; } } } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 43
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 42
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 42
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 41
Branch analysis from position: 19
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 40
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 40
Branch analysis from position: 23
2 jumps found. (Code = 77) Position 1 = 28, Position 2 = 37
Branch analysis from position: 28
2 jumps found. (Code = 78) Position 1 = 29, Position 2 = 37
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 37
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 40
Branch analysis from position: 41
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
Branch analysis from position: 43
filename:       /in/fljJA
function name:  (null)
number of ops:  44
compiled vars:  !0 = $xml, !1 = $job_simple, !2 = $customer, !3 = $i, !4 = $job, !5 = $driver
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cfindit+xmlns%3D%22http%3A%2F%2Fwww.URL.COM%22+version%3D%228%22+type%3D%22TIX%22+date%3D%2220160323%22%3E%0A++%3Caccount+code%3D%22XXXXXX%22%3E%0A++++%3Ccustomers%3E%0A++++++%3Ccustomer+code%3D%2212345%22%3E%0A++++++++%3Cstatus+code%3D%220%22%3ESuccess%3C%2Fstatus%3E%0A++++++++%3Clogistic-jobs%3E%0A++++++++++%3Clogistic-job+id%3D%2212345%22+date%3D%2220160324%22+status%3D%22PLA%22+modified%3D%22201603231420%22%3E%0A++++++++%3Cnumber%3E%0A++++++++++%3Cnumber1%3E479599%3C%2Fnumber1%3E%0A++++++++++%3Cnumber3%3E11221%3C%2Fnumber3%3E%0A++++++++%3C%2Fnumber%3E%0A++++++++%3Ccollection+date%3D%2220160324%22+time%3D%220500%22%3E%0A++++++++++%3Cname%3EJOHN+SMITH%3C%2Fname%3E%0A++++++++++%3Caddress1%3EUNIT+3+DAVEY+ROAD%3C%2Faddress1%3E%0A++++++++++%3Caddress2%3EFIELDS+END+BUSINESS+PARK%3C%2Faddress2%3E%0A++++++++++%3Caddress3%3EGOLDTHORPE%3C%2Faddress3%3E%0A++++++++++%3Caddress4%3EROTHERHAM%3C%2Faddress4%3E%0A++++++++++%3Caddress5%3ES63+0JF%3C%2Faddress5%3E%0A++++++++%3C%2Fcollection%3E%0A++++++++%3Cdelivery+date%3D%2220160324%22+time%3D%221200%22%3E%0A++++++++++%3Caddress1%3EEXAMPLE%3C%2Faddress1%3E%0A++++++++++%3Caddress2%3EGLENEAFLES+FARM%3C%2Faddress2%3E%0A++++++++++%3Caddress3%3EGLENEAGLES+CLOSE%3C%2Faddress3%3E%0A++++++++++%3Caddress4%3ESTANWELL%2C+MIDDLESEX%3C%2Faddress4%3E%0A++++++++++%3Caddress5%3ETW19+7PD%3C%2Faddress5%3E%0A++++++++%3C%2Fdelivery%3E%0A++++++++%3Cextra%3E%0A++++++++++%3Caddress1%3E45FT+C%2FSIDER%3C%2Faddress1%3E%0A++++++++++%3Caddress2%3ENo%3C%2Faddress2%3E%0A++++++++++%3Caddress4%3ECEMENT%3C%2Faddress4%3E%0A++++++++%3C%2Fextra%3E%0A++++++++%3Cdrivers%3E%0A++++++++++%3Cdriver+code%3D%22TM1%22%3EDAVE+SMITH+%28DAYS%29%3C%2Fdriver%3E%0A++++++++%3C%2Fdrivers%3E%0A++++++++%3Cload+weight%3D%2227600.00%22+volume%3D%220.00%22%3E%0A++++++++++%3Cpallets+full%3D%2223%22+half%3D%220%22+quarter%3D%220%22+blue%3D%220%22+oversize%3D%220%22%2F%3E%0A++++++++%3C%2Fload%3E%0A++++++%3C%2Flogistic-job%3E%0A++++%3C%2Flogistic-jobs%3E%0A++%3C%2Fcustomer%3E%0A%3C%2Fcustomers%3E%0A%3C%2Faccount%3E%0A%3C%2Ffindit%3E'
   49     1        INIT_FCALL                                               'simplexml_load_string'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $7      
          4        ASSIGN                                                   !1, $7
   51     5        FETCH_OBJ_IS                                     ~9      !1, 'account'
          6        FETCH_OBJ_IS                                     ~10     ~9, 'customers'
          7        ISSET_ISEMPTY_PROP_OBJ                                   ~10, 'customer'
          8      > JMPZ                                                     ~11, ->43
   54     9    >   FETCH_OBJ_R                                      ~12     !1, 'account'
         10        FETCH_OBJ_R                                      ~13     ~12, 'customers'
         11        FETCH_OBJ_R                                      ~14     ~13, 'customer'
         12      > FE_RESET_R                                       $15     ~14, ->42
         13    > > FE_FETCH_R                                       ~16     $15, !2, ->42
         14    >   ASSIGN                                                   !3, ~16
   57    15        FETCH_OBJ_R                                      ~18     !2, 'status'
         16        CAST                                          6  ~19     ~18
         17        IS_EQUAL                                                 ~19, 'Success'
         18      > JMPZ                                                     ~20, ->41
   60    19    >   FETCH_OBJ_R                                      ~21     !2, 'logistic-jobs'
         20        FETCH_OBJ_R                                      ~22     ~21, 'logistic-job'
         21      > FE_RESET_R                                       $23     ~22, ->40
         22    > > FE_FETCH_R                                       ~24     $23, !4, ->40
         23    >   ASSIGN                                                   !3, ~24
   61    24        ECHO                                                     '%3Cul%3E%0A'
   62    25        FETCH_OBJ_R                                      ~26     !4, 'drivers'
         26        FETCH_OBJ_R                                      ~27     ~26, 'driver'
         27      > FE_RESET_R                                       $28     ~27, ->37
         28    > > FE_FETCH_R                                               $28, !5, ->37
   63    29    >   ROPE_INIT                                     5  ~31     '%3Cli%3E+'
         30        FETCH_DIM_R                                      ~29     !5, 'code'
         31        ROPE_ADD                                      1  ~31     ~31, ~29
         32        ROPE_ADD                                      2  ~31     ~31, '%3A+'
         33        ROPE_ADD                                      3  ~31     ~31, !5
         34        ROPE_END                                      4  ~30     ~31, '%0A'
         35        ECHO                                                     ~30
   62    36      > JMP                                                      ->28
         37    >   FE_FREE                                                  $28
   65    38        ECHO                                                     '%3C%2Ful%3E%0A'
   60    39      > JMP                                                      ->22
         40    >   FE_FREE                                                  $23
   54    41    > > JMP                                                      ->13
         42    >   FE_FREE                                                  $15
   69    43    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.82 ms | 1442 KiB | 14 Q