3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ (object)[ 'label' => 'Test 1', 'session' => 2 ], (object)[ 'label' => 'Test 2', 'session' => 2 ], (object)[ 'label' => 'Test 3', 'session' => 42 ], (object)[ 'label' => 'Test 4', 'session' => 9 ] ]; $result = array_map(function($x){ return $x->session; }, $array); echo count(array_unique($result));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6ci8h
function name:  (null)
number of ops:  21
compiled vars:  !0 = $array, !1 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   CAST                                              8  ~2      <array>
          1        INIT_ARRAY                                           ~3      ~2
          2        CAST                                              8  ~4      <array>
          3        ADD_ARRAY_ELEMENT                                    ~3      ~4
          4        CAST                                              8  ~5      <array>
          5        ADD_ARRAY_ELEMENT                                    ~3      ~5
          6        CAST                                              8  ~6      <array>
          7        ADD_ARRAY_ELEMENT                                    ~3      ~6
    3     8        ASSIGN                                                       !0, ~3
   22     9        INIT_FCALL                                                   'array_map'
         10        DECLARE_LAMBDA_FUNCTION                              ~8      [0]
   24    11        SEND_VAL                                                     ~8
         12        SEND_VAR                                                     !0
   22    13        DO_ICALL                                             $9      
         14        ASSIGN                                                       !1, $9
   26    15        INIT_FCALL                                                   'array_unique'
         16        SEND_VAR                                                     !1
         17        DO_ICALL                                             $11     
         18        COUNT                                                ~12     $11
         19        ECHO                                                         ~12
         20      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6ci8h
function name:  {closure:/in/6ci8h:22}
number of ops:  4
compiled vars:  !0 = $x
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   22     0  E >   RECV                                                 !0      
   23     1        FETCH_OBJ_R                                          ~1      !0, 'session'
          2      > RETURN                                                       ~1
   24     3*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.92 ms | 2552 KiB | 15 Q