3v4l.org

run code in 500+ PHP versions simultaneously
<?php $json = ' { "TrackResponse": { "Shipment": { "Package": { "TrackingNumber": "1Z7V015Y6870100000", "Activity": { "ActivityLocation": { "Address": { "City": "Caledon", "StateProvinceCode": "ON", "CountryCode": "CA" } }, "Status": { "Type": "I", "Description": "Departed from Facility", "Code": "DP" }, "Date": "20230322", "Time": "003100" }, "Activity2": [ { "ActivityLocation": { "Address": { "City": "Caledon", "StateProvinceCode": "ON", "CountryCode": "CA" } }, "Status": { "Type": "I", "Description": "Departed from Facility", "Code": "DP" }, "Date": "20230322", "Time": "003100" }, { "ActivityLocation": { "Address": { "City": "Caledon", "StateProvinceCode": "ON", "CountryCode": "CA" } }, "Status": { "Type": "I", "Description": "Arrived at Facility", "Code": "AR" }, "Date": "20230321", "Time": "115000" }, { "ActivityLocation": { "Address": { "City": "Windsor", "StateProvinceCode": "ON", "CountryCode": "CA" } }, "Status": { "Type": "I", "Description": "Departed from Facility", "Code": "DP" }, "Date": "20230320", "Time": "180900" } ] } } } } '; $data = json_decode($json); $activity = $data->TrackResponse->Shipment->Package->Activity; $activity2 = $data->TrackResponse->Shipment->Package->Activity2; if (is_object($activity)) { print_r(' Activity is an object '); } else { print_r(' Activity is NOT an object '); } if (is_array($activity)) { print_r(' Activity is an array '); } else { print_r(' Activity is NOT an array '); } if (is_object($activity2)) { print_r(' Activity2 is an object '); } else { print_r(' Activity2 is NOT an object '); } if (is_array($activity2)) { print_r(' Activity2 is an array '); } else { print_r(' Activity2 is NOT an array '); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 21
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 30
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 39
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 48
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 48
Branch analysis from position: 44
Branch analysis from position: 48
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 39
Branch analysis from position: 35
Branch analysis from position: 39
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 30
Branch analysis from position: 26
Branch analysis from position: 30
filename:       /in/ljkLc
function name:  (null)
number of ops:  52
compiled vars:  !0 = $json, !1 = $data, !2 = $activity, !3 = $activity2
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%0A%7B%0A++%22TrackResponse%22%3A+%7B%0A++++%22Shipment%22%3A+%7B%0A++++++%22Package%22%3A+%7B%0A++++++++%22TrackingNumber%22%3A+%221Z7V015Y6870100000%22%2C%0A++++++++%22Activity%22%3A+%7B%0A++++++++++%22ActivityLocation%22%3A+%7B%0A++++++++++++++%22Address%22%3A+%7B%0A++++++++++++++++%22City%22%3A+%22Caledon%22%2C%0A++++++++++++++++%22StateProvinceCode%22%3A+%22ON%22%2C%0A++++++++++++++++%22CountryCode%22%3A+%22CA%22%0A++++++++++++++%7D%0A++++++++++++%7D%2C%0A++++++++++++%22Status%22%3A+%7B%0A++++++++++++++%22Type%22%3A+%22I%22%2C%0A++++++++++++++%22Description%22%3A+%22Departed+from+Facility%22%2C%0A++++++++++++++%22Code%22%3A+%22DP%22%0A++++++++++++%7D%2C%0A++++++++++++%22Date%22%3A+%2220230322%22%2C%0A++++++++++++%22Time%22%3A+%22003100%22%0A++++++++%7D%2C%0A++++++++%22Activity2%22%3A+%5B%0A++++++++++%7B%0A++++++++++++%22ActivityLocation%22%3A+%7B%0A++++++++++++++%22Address%22%3A+%7B%0A++++++++++++++++%22City%22%3A+%22Caledon%22%2C%0A++++++++++++++++%22StateProvinceCode%22%3A+%22ON%22%2C%0A++++++++++++++++%22CountryCode%22%3A+%22CA%22%0A++++++++++++++%7D%0A++++++++++++%7D%2C%0A++++++++++++%22Status%22%3A+%7B%0A++++++++++++++%22Type%22%3A+%22I%22%2C%0A++++++++++++++%22Description%22%3A+%22Departed+from+Facility%22%2C%0A++++++++++++++%22Code%22%3A+%22DP%22%0A++++++++++++%7D%2C%0A++++++++++++%22Date%22%3A+%2220230322%22%2C%0A++++++++++++%22Time%22%3A+%22003100%22%0A++++++++++%7D%2C%0A++++++++++%7B%0A++++++++++++%22ActivityLocation%22%3A+%7B%0A++++++++++++++%22Address%22%3A+%7B%0A++++++++++++++++%22City%22%3A+%22Caledon%22%2C%0A++++++++++++++++%22StateProvinceCode%22%3A+%22ON%22%2C%0A++++++++++++++++%22CountryCode%22%3A+%22CA%22%0A++++++++++++++%7D%0A++++++++++++%7D%2C%0A++++++++++++%22Status%22%3A+%7B%0A++++++++++++++%22Type%22%3A+%22I%22%2C%0A++++++++++++++%22Description%22%3A+%22Arrived+at+Facility%22%2C%0A++++++++++++++%22Code%22%3A+%22AR%22%0A++++++++++++%7D%2C%0A++++++++++++%22Date%22%3A+%2220230321%22%2C%0A++++++++++++%22Time%22%3A+%22115000%22%0A++++++++++%7D%2C%0A++++++++++%7B%0A++++++++++++%22ActivityLocation%22%3A+%7B%0A++++++++++++++%22Address%22%3A+%7B%0A++++++++++++++++%22City%22%3A+%22Windsor%22%2C%0A++++++++++++++++%22StateProvinceCode%22%3A+%22ON%22%2C%0A++++++++++++++++%22CountryCode%22%3A+%22CA%22%0A++++++++++++++%7D%0A++++++++++++%7D%2C%0A++++++++++++%22Status%22%3A+%7B%0A++++++++++++++%22Type%22%3A+%22I%22%2C%0A++++++++++++++%22Description%22%3A+%22Departed+from+Facility%22%2C%0A++++++++++++++%22Code%22%3A+%22DP%22%0A++++++++++++%7D%2C%0A++++++++++++%22Date%22%3A+%2220230320%22%2C%0A++++++++++++%22Time%22%3A+%22180900%22%0A++++++++++%7D%0A%0A++++++++%5D%0A++++++%7D%0A++++%7D%0A++%7D%0A%7D%0A'
   81     1        INIT_FCALL                                                   'json_decode'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $5      
          4        ASSIGN                                                       !1, $5
   83     5        FETCH_OBJ_R                                          ~7      !1, 'TrackResponse'
          6        FETCH_OBJ_R                                          ~8      ~7, 'Shipment'
          7        FETCH_OBJ_R                                          ~9      ~8, 'Package'
          8        FETCH_OBJ_R                                          ~10     ~9, 'Activity'
          9        ASSIGN                                                       !2, ~10
   84    10        FETCH_OBJ_R                                          ~12     !1, 'TrackResponse'
         11        FETCH_OBJ_R                                          ~13     ~12, 'Shipment'
         12        FETCH_OBJ_R                                          ~14     ~13, 'Package'
         13        FETCH_OBJ_R                                          ~15     ~14, 'Activity2'
         14        ASSIGN                                                       !3, ~15
   86    15        TYPE_CHECK                                      256          !2
         16      > JMPZ                                                         ~17, ->21
   87    17    >   INIT_FCALL                                                   'print_r'
         18        SEND_VAL                                                     '+Activity+is+an+object+'
         19        DO_ICALL                                                     
   86    20      > JMP                                                          ->24
   89    21    >   INIT_FCALL                                                   'print_r'
         22        SEND_VAL                                                     '+Activity+is+NOT+an+object+'
         23        DO_ICALL                                                     
   92    24    >   TYPE_CHECK                                      128          !2
         25      > JMPZ                                                         ~20, ->30
   93    26    >   INIT_FCALL                                                   'print_r'
         27        SEND_VAL                                                     '+Activity+is+an+array+'
         28        DO_ICALL                                                     
   92    29      > JMP                                                          ->33
   95    30    >   INIT_FCALL                                                   'print_r'
         31        SEND_VAL                                                     '+Activity+is+NOT+an+array+'
         32        DO_ICALL                                                     
   98    33    >   TYPE_CHECK                                      256          !3
         34      > JMPZ                                                         ~23, ->39
   99    35    >   INIT_FCALL                                                   'print_r'
         36        SEND_VAL                                                     '+Activity2+is+an+object+'
         37        DO_ICALL                                                     
   98    38      > JMP                                                          ->42
  101    39    >   INIT_FCALL                                                   'print_r'
         40        SEND_VAL                                                     '+Activity2+is+NOT+an+object+'
         41        DO_ICALL                                                     
  104    42    >   TYPE_CHECK                                      128          !3
         43      > JMPZ                                                         ~26, ->48
  105    44    >   INIT_FCALL                                                   'print_r'
         45        SEND_VAL                                                     '+Activity2+is+an+array+'
         46        DO_ICALL                                                     
  104    47      > JMP                                                          ->51
  107    48    >   INIT_FCALL                                                   'print_r'
         49        SEND_VAL                                                     '+Activity2+is+NOT+an+array+'
         50        DO_ICALL                                                     
  108    51    > > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.85 ms | 1737 KiB | 15 Q