3v4l.org

run code in 500+ PHP versions simultaneously
<?php $accountdata = array( array("name" => "test1", "email" => "test1@test.com"), array("name" => "test2", "email" => "test2@test.com"), array("name" => "test3", "email" => "test3@test.com"), array("name" => "test4", "email" => "test4@test.com"), ); foreach ($accountdata as $row) { $data[$row["email"]] = [ 'name' => $row["name"], 'email' => $row["email"] ]; } echo json_encode($data, JSON_UNESCAPED_UNICODE);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 11
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 11
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/4VYEg
function name:  (null)
number of ops:  18
compiled vars:  !0 = $accountdata, !1 = $row, !2 = $data
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   10     1      > FE_RESET_R                                           $4      !0, ->11
          2    > > FE_FETCH_R                                                   $4, !1, ->11
   11     3    >   FETCH_DIM_R                                          ~5      !1, 'email'
   12     4        FETCH_DIM_R                                          ~7      !1, 'name'
          5        INIT_ARRAY                                           ~8      ~7, 'name'
   13     6        FETCH_DIM_R                                          ~9      !1, 'email'
          7        ADD_ARRAY_ELEMENT                                    ~8      ~9, 'email'
   11     8        ASSIGN_DIM                                                   !2, ~5
   13     9        OP_DATA                                                      ~8
   10    10      > JMP                                                          ->2
         11    >   FE_FREE                                                      $4
   17    12        INIT_FCALL                                                   'json_encode'
         13        SEND_VAR                                                     !2
         14        SEND_VAL                                                     256
         15        DO_ICALL                                             $10     
         16        ECHO                                                         $10
         17      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.05 ms | 1773 KiB | 14 Q