3v4l.org

run code in 300+ PHP versions simultaneously
<?php $file = '[ { "fields": { "service_number": "service_number", "physical_address": "physical_address", "account_id": "account_id", "contact_id": "contact_id" }, "someId": "asd23f", "status": "Active", "perCode": "1", "idCode": "0987", "nextCode": "09" }, { "fields": { "service_number": "service_number", "physical_address": "physical_address", "account_id": "account_id", "contact_id": "contact_id" }, "someId": "789096", "status": "Active", "perCode": "1", "idCode": "076543", "nextCode": "09" } ]'; $userId = 123; $data = json_decode($file, true); foreach ($data as &$val) { $val['user_id'] = $userId; } print_r($data);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
2 jumps found. (Code = 126) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/ZF4Ve
function name:  (null)
number of ops:  17
compiled vars:  !0 = $file, !1 = $userId, !2 = $data, !3 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%5B%0A++%7B%0A++++%22fields%22%3A+%7B%0A++++++%22service_number%22%3A+%22service_number%22%2C%0A++++++%22physical_address%22%3A+%22physical_address%22%2C%0A++++++%22account_id%22%3A+%22account_id%22%2C%0A++++++%22contact_id%22%3A+%22contact_id%22%0A++++%7D%2C%0A++++%22someId%22%3A+%22asd23f%22%2C%0A++++%22status%22%3A+%22Active%22%2C%0A++++%22perCode%22%3A+%221%22%2C%0A++++%22idCode%22%3A+%220987%22%2C%0A++++%22nextCode%22%3A+%2209%22%0A++%7D%2C%0A++%7B%0A++++%22fields%22%3A+%7B%0A++++++%22service_number%22%3A+%22service_number%22%2C%0A++++++%22physical_address%22%3A+%22physical_address%22%2C%0A++++++%22account_id%22%3A+%22account_id%22%2C%0A++++++%22contact_id%22%3A+%22contact_id%22%0A++++%7D%2C%0A++++%22someId%22%3A+%22789096%22%2C%0A++++%22status%22%3A+%22Active%22%2C%0A++++%22perCode%22%3A+%221%22%2C%0A++++%22idCode%22%3A+%22076543%22%2C%0A++++%22nextCode%22%3A+%2209%22%0A++%7D%0A%5D'
   32     1        ASSIGN                                                   !1, 123
   34     2        INIT_FCALL                                               'json_decode'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !2, $6
   35     7      > FE_RESET_RW                                      $8      !2, ->12
          8    > > FE_FETCH_RW                                              $8, !3, ->12
   36     9    >   ASSIGN_DIM                                               !3, 'user_id'
         10        OP_DATA                                                  !1
   35    11      > JMP                                                      ->8
         12    >   FE_FREE                                                  $8
   39    13        INIT_FCALL                                               'print_r'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
240.62 ms | 1001 KiB | 15 Q