3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{ "Status": "success", "data": { "riwayat": [ { "manifest_code": "", "manifest_description": "SHIPMENT RECEIVED BY JNE COUNTER OFFICER AT [MAKASAR]", "manifest_date": "2019-07-30", "manifest_time": "20:15", "city_name": "" }, { "manifest_code": "", "manifest_description": "SHIPMENT PICKED UP BY JNE COURIER [MAKASAR]", "manifest_date": "2019-07-30", "manifest_time": "21:29", "city_name": "" } ] } }'; $jsonToArray = json_decode($json, true); $oldKey = 'manifest_description'; $newKey = 'manifest_description_new'; array_walk($jsonToArray['data']['riwayat'], function(&$v, $k) use ($oldKey,$newKey){ $oldValue = $v[$oldKey]; isset($v[$oldKey]) ? ($v[$newKey] = $oldValue) : ''; }); print_r($jsonToArray);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CnXSB
function name:  (null)
number of ops:  21
compiled vars:  !0 = $json, !1 = $jsonToArray, !2 = $oldKey, !3 = $newKey
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7B%0A%22Status%22%3A+%22success%22%2C%0A%22data%22%3A+%7B%0A++%22riwayat%22%3A+%5B%0A+++++++%7B%0A++++%22manifest_code%22%3A+%22%22%2C%0A++++%22manifest_description%22%3A+%22SHIPMENT+RECEIVED+BY+JNE+COUNTER+OFFICER+AT+%5BMAKASAR%5D%22%2C%0A++++%22manifest_date%22%3A+%222019-07-30%22%2C%0A++++%22manifest_time%22%3A+%2220%3A15%22%2C%0A++++%22city_name%22%3A+%22%22%0A+++++%7D%2C%0A++++%7B%0A++++%22manifest_code%22%3A+%22%22%2C%0A++++%22manifest_description%22%3A+%22SHIPMENT+PICKED+UP+BY+JNE+COURIER+%5BMAKASAR%5D%22%2C%0A++++%22manifest_date%22%3A+%222019-07-30%22%2C%0A++++%22manifest_time%22%3A+%2221%3A29%22%2C%0A++++%22city_name%22%3A+%22%22%0A+++++%7D%0A+++%5D%0A+%7D%0A%7D'
   25     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
   26     6        ASSIGN                                                   !2, 'manifest_description'
   27     7        ASSIGN                                                   !3, 'manifest_description_new'
   28     8        INIT_FCALL                                               'array_walk'
          9        FETCH_DIM_W                                      $9      !1, 'data'
         10        FETCH_DIM_W                                      $10     $9, 'riwayat'
         11        SEND_REF                                                 $10
         12        DECLARE_LAMBDA_FUNCTION                          ~11     [0]
         13        BIND_LEXICAL                                             ~11, !2
         14        BIND_LEXICAL                                             ~11, !3
   31    15        SEND_VAL                                                 ~11
   28    16        DO_ICALL                                                 
   33    17        INIT_FCALL                                               'print_r'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                                 
         20      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CnXSB
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $v, !1 = $k, !2 = $oldKey, !3 = $newKey, !4 = $oldValue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        BIND_STATIC                                              !3
   29     4        FETCH_DIM_R                                      ~5      !0, !2
          5        ASSIGN                                                   !4, ~5
   30     6        ISSET_ISEMPTY_DIM_OBJ                         0          !0, !2
          7      > JMPZ                                                     ~7, ->12
          8    >   ASSIGN_DIM                                       ~8      !0, !3
          9        OP_DATA                                                  !4
         10        QM_ASSIGN                                        ~9      ~8
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~9      ''
         13    >   FREE                                                     ~9
   31    14      > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.38 ms | 1017 KiB | 16 Q