3v4l.org

run code in 300+ 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
    9     2        CAST                                          8  ~4      <array>
          3        ADD_ARRAY_ELEMENT                                ~3      ~4
   13     4        CAST                                          8  ~5      <array>
          5        ADD_ARRAY_ELEMENT                                ~3      ~5
   17     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                                  '%00%7Bclosure%7D%2Fin%2F6ci8h%3A22%240'
   24    11        SEND_VAL                                                 ~8
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $9      
   22    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

Function %00%7Bclosure%7D%2Fin%2F6ci8h%3A22%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6ci8h
function name:  {closure}
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 function %00%7Bclosure%7D%2Fin%2F6ci8h%3A22%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.31 ms | 1400 KiB | 17 Q