3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = ["a", "b", "a", "c"]; var_export( array_map( function ($v) { static $lookup = []; $lookup[$v] ??= 0; return $v . ($lookup[$v]++ ?: ''); }, $array ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l2Voh
function name:  (null)
number of ops:  10
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        INIT_FCALL                                               'var_export'
    6     2        INIT_FCALL                                               'array_map'
    7     3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   11     4        SEND_VAL                                                 ~2
   12     5        SEND_VAR                                                 !0
    6     6        DO_ICALL                                         $3      
   12     7        SEND_VAR                                                 $3
    5     8        DO_ICALL                                                 
   14     9      > 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/l2Voh
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $v, !1 = $lookup
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        BIND_STATIC                                              !1
    9     2        FETCH_DIM_IS                                     ~2      !1, !0
          3        COALESCE                                         ~3      ~2
          4        ASSIGN_DIM                                       ~4      !1, !0
          5        OP_DATA                                                  0
          6        QM_ASSIGN                                        ~3      ~4
          7        FREE                                                     ~3
   10     8        FETCH_DIM_RW                                     $5      !1, !0
          9        POST_INC                                         ~6      $5
         10        JMP_SET                                          ~7      ~6, ->12
         11        QM_ASSIGN                                        ~7      ''
         12        CONCAT                                           ~8      !0, ~7
         13      > RETURN                                                   ~8
   11    14*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.93 ms | 1011 KiB | 15 Q