3v4l.org

run code in 300+ 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 = 47
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 47
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 39
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 32
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 32
Branch analysis from position: 15
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 26
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 31
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 31
Branch analysis from position: 26
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 32
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 46
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 46
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
filename:       /in/r0ZJB
function name:  getUniqueObjectKeyPaths
number of ops:  50
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, ->47
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->47
          5    >   ASSIGN                                                   !1, ~9
   18     6        TYPE_CHECK                                  128          !3
          7      > JMPZ                                                     ~11, ->39
   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, ->32
         14    > > FE_FETCH_R                                       ~15     $14, !5, ->32
         15    >   ASSIGN                                                   !6, ~15
   21    16        INIT_FCALL                                               'is_numeric'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $17     
         19        BOOL_NOT                                         ~18     $17
         20      > JMPZ_EX                                          ~18     ~18, ->26
         21    >   INIT_FCALL                                               'is_numeric'
         22        SEND_VAR                                                 !5
         23        DO_ICALL                                         $19     
         24        BOOL_NOT                                         ~20     $19
         25        BOOL                                             ~18     ~20
         26    > > JMPZ                                                     ~18, ->31
   22    27    >   CONCAT                                           ~22     !1, '-%3E'
         28        CONCAT                                           ~23     ~22, !5
         29        ASSIGN_DIM                                               !4, !6
         30        OP_DATA                                                  ~23
   20    31    > > JMP                                                      ->14
         32    >   FE_FREE                                                  $14
   25    33        INIT_FCALL                                               'array_push'
         34        SEND_REF                                                 !2
         35        SEND_UNPACK                                              !4
         36        CHECK_UNDEF_ARGS                                         
         37        DO_ICALL                                                 
   18    38      > JMP                                                      ->46
   26    39    >   INIT_FCALL                                               'is_numeric'
         40        SEND_VAR                                                 !1
         41        DO_ICALL                                         $25     
         42        BOOL_NOT                                         ~26     $25
         43      > JMPZ                                                     ~26, ->46
   27    44    >   ASSIGN_DIM                                               !2
         45        OP_DATA                                                  !1
   17    46    > > JMP                                                      ->4
         47    >   FE_FREE                                                  $8
   30    48      > RETURN                                                   !2
   31    49*     > RETURN                                                   null

End of function getuniqueobjectkeypaths

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.12 ms | 1441 KiB | 18 Q