3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = json_decode('{"client":"4","gateWay":"1","store":"store.shop.com", "valid":"true","po":34535,"additionalPO":23423,"customerNotes":"", "orderItems":[{"item":"123","quantity":10,"supplierLotNo":"", "customsValue":"","customsDescription":"","hsCode":""}, {"item":"345","quantity":50}], "shippingInfos":[{"address":{"city":"Chennai", "country":"India","postalCode":"86715","state":"TN", "streetAddress1":"6971 North Street","streetAddress2":null}, "contact":{"company":null,"email":"info@store.com","firstName":"test", "lastName":"test","phoneNo":null},"ServiceId":"3","thirdPartyAccountNo":"", "signatureConfirmation":false,"saturdayDelivery":false}]}',true); function getUniqueObjectKeyPaths($array, $parentKey = "") { $keys = []; foreach ($array as $parentKey => $v) { if (is_array($v)) { $nestedKeys = getUniqueObjectKeyPaths($v, $parentKey); foreach($nestedKeys as $index => $key) { if (!is_numeric($parentKey) && !is_numeric($key)) { $nestedKeys[$index] = $parentKey . "->" . $key; } } array_push($keys, ...$nestedKeys); } elseif (!is_numeric($parentKey)) { $keys[] = $parentKey; } } return $keys; } var_export(getUniqueObjectKeyPaths($array));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r0ZJB
function name:  (null)
number of ops:  12
compiled vars:  !0 = $array
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'json_decode'
          1        SEND_VAL                                                     '%7B%22client%22%3A%224%22%2C%22gateWay%22%3A%221%22%2C%22store%22%3A%22store.shop.com%22%2C%0A%22valid%22%3A%22true%22%2C%22po%22%3A34535%2C%22additionalPO%22%3A23423%2C%22customerNotes%22%3A%22%22%2C%0A%22orderItems%22%3A%5B%7B%22item%22%3A%22123%22%2C%22quantity%22%3A10%2C%22supplierLotNo%22%3A%22%22%2C%0A%22customsValue%22%3A%22%22%2C%22customsDescription%22%3A%22%22%2C%22hsCode%22%3A%22%22%7D%2C%0A%7B%22item%22%3A%22345%22%2C%22quantity%22%3A50%7D%5D%2C%0A%22shippingInfos%22%3A%5B%7B%22address%22%3A%7B%22city%22%3A%22Chennai%22%2C%0A%22country%22%3A%22India%22%2C%22postalCode%22%3A%2286715%22%2C%22state%22%3A%22TN%22%2C%0A%22streetAddress1%22%3A%226971+North+Street%22%2C%22streetAddress2%22%3Anull%7D%2C%0A%22contact%22%3A%7B%22company%22%3Anull%2C%22email%22%3A%22info%40store.com%22%2C%22firstName%22%3A%22test%22%2C%0A%22lastName%22%3A%22test%22%2C%22phoneNo%22%3Anull%7D%2C%22ServiceId%22%3A%223%22%2C%22thirdPartyAccountNo%22%3A%22%22%2C%0A%22signatureConfirmation%22%3Afalse%2C%22saturdayDelivery%22%3Afalse%7D%5D%7D'
   13     2        SEND_VAL                                                     <true>
    3     3        DO_ICALL                                             $1      
          4        ASSIGN                                                       !0, $1
   32     5        INIT_FCALL                                                   'var_export'
          6        INIT_FCALL                                                   'getuniqueobjectkeypaths'
          7        SEND_VAR                                                     !0
          8        DO_FCALL                                          0  $3      
          9        SEND_VAR                                                     $3
         10        DO_ICALL                                                     
         11      > RETURN                                                       1

Function getuniqueobjectkeypaths:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 41
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 41
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 35
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 28
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 28
Branch analysis from position: 15
2 jumps found. (Code = 46) Position 1 = 19, Position 2 = 22
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 27
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 27
Branch analysis from position: 22
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 28
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 40
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
filename:       /in/r0ZJB
function name:  getUniqueObjectKeyPaths
number of ops:  44
compiled vars:  !0 = $array, !1 = $parentKey, !2 = $keys, !3 = $v, !4 = $nestedKeys, !5 = $key, !6 = $index
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   RECV                                                 !0      
          1        RECV_INIT                                            !1      ''
   16     2        ASSIGN                                                       !2, <array>
   17     3      > FE_RESET_R                                           $8      !0, ->41
          4    > > FE_FETCH_R                                           ~9      $8, !3, ->41
          5    >   ASSIGN                                                       !1, ~9
   18     6        TYPE_CHECK                                      128          !3
          7      > JMPZ                                                         ~11, ->35
   19     8    >   INIT_FCALL_BY_NAME                                           'getUniqueObjectKeyPaths'
          9        SEND_VAR_EX                                                  !3
         10        SEND_VAR_EX                                                  !1
         11        DO_FCALL                                          0  $12     
         12        ASSIGN                                                       !4, $12
   20    13      > FE_RESET_R                                           $14     !4, ->28
         14    > > FE_FETCH_R                                           ~15     $14, !5, ->28
         15    >   ASSIGN                                                       !6, ~15
   21    16        FRAMELESS_ICALL_1                is_numeric          ~17     !1
         17        BOOL_NOT                                             ~18     ~17
         18      > JMPZ_EX                                              ~18     ~18, ->22
         19    >   FRAMELESS_ICALL_1                is_numeric          ~19     !5
         20        BOOL_NOT                                             ~20     ~19
         21        BOOL                                                 ~18     ~20
         22    > > JMPZ                                                         ~18, ->27
   22    23    >   CONCAT                                               ~22     !1, '-%3E'
         24        CONCAT                                               ~23     ~22, !5
         25        ASSIGN_DIM                                                   !4, !6
         26        OP_DATA                                                      ~23
   20    27    > > JMP                                                          ->14
         28    >   FE_FREE                                                      $14
   25    29        INIT_FCALL                                                   'array_push'
         30        SEND_REF                                                     !2
         31        SEND_UNPACK                                                  !4
         32        CHECK_UNDEF_ARGS                                             
         33        DO_ICALL                                                     
   18    34      > JMP                                                          ->40
   26    35    >   FRAMELESS_ICALL_1                is_numeric          ~25     !1
         36        BOOL_NOT                                             ~26     ~25
         37      > JMPZ                                                         ~26, ->40
   27    38    >   ASSIGN_DIM                                                   !2
         39        OP_DATA                                                      !1
   17    40    > > JMP                                                          ->4
         41    >   FE_FREE                                                      $8
   30    42      > RETURN                                                       !2
   31    43*     > RETURN                                                       null

End of function getuniqueobjectkeypaths

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.6 ms | 2250 KiB | 17 Q