3v4l.org

run code in 300+ PHP versions simultaneously
<?php $o1 = new stdClass(); $o1->id = 123; $o1->title = 'test'; $o2 = new stdClass(); $o2->id = 456; $o2->title = 'test2'; $arrofobjects = [ $o1,$o2 ]; var_dump($arrofobjects); $newArr = array_map(function($obj) { return [$obj->id => $obj->title]; }, $arrofobjects); var_dump($newArr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DsQKT
function name:  (null)
number of ops:  30
compiled vars:  !0 = $o1, !1 = $o2, !2 = $arrofobjects, !3 = $newArr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $4      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
    3     3        ASSIGN_OBJ                                               !0, 'id'
          4        OP_DATA                                                  123
    4     5        ASSIGN_OBJ                                               !0, 'title'
          6        OP_DATA                                                  'test'
    6     7        NEW                                              $9      'stdClass'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $9
    7    10        ASSIGN_OBJ                                               !1, 'id'
         11        OP_DATA                                                  456
    8    12        ASSIGN_OBJ                                               !1, 'title'
         13        OP_DATA                                                  'test2'
   11    14        INIT_ARRAY                                       ~14     !0
         15        ADD_ARRAY_ELEMENT                                ~14     !1
   10    16        ASSIGN                                                   !2, ~14
   14    17        INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                                 
   16    20        INIT_FCALL                                               'array_map'
         21        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FDsQKT%3A16%240'
   18    22        SEND_VAL                                                 ~17
         23        SEND_VAR                                                 !2
         24        DO_ICALL                                         $18     
   16    25        ASSIGN                                                   !3, $18
   20    26        INIT_FCALL                                               'var_dump'
         27        SEND_VAR                                                 !3
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FDsQKT%3A16%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DsQKT
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        FETCH_OBJ_R                                      ~1      !0, 'id'
          2        FETCH_OBJ_R                                      ~2      !0, 'title'
          3        INIT_ARRAY                                       ~3      ~2, ~1
          4      > RETURN                                                   ~3
   18     5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FDsQKT%3A16%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.54 ms | 1396 KiB | 17 Q