3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 'foo', 'foo', 'bar', 'baz', 'baz' ]; array_walk($arr, function ($item, $k) use ($arr) { $lower = mb_strtolower($item, 'utf-8'); foreach ($arr as $i => $v) { var_dump($k .'='. $i); if ($i !== $k && $v !== null && $lower === mb_strtolower($v, 'utf-8')) { var_dump('rm'); unset($arr[$i]); } } }); var_dump($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nb7Nt
function name:  (null)
number of ops:  11
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        INIT_FCALL                                               'array_walk'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fnb7Nt%3A10%240'
          4        BIND_LEXICAL                                             ~2, !0
   19     5        SEND_VAL                                                 ~2
          6        DO_ICALL                                                 
   20     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fnb7Nt%3A10%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 33
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 33
Branch analysis from position: 10
2 jumps found. (Code = 46) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 27
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 32
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 32
Branch analysis from position: 27
Branch analysis from position: 20
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/nb7Nt
function name:  {closure}
number of ops:  35
compiled vars:  !0 = $item, !1 = $k, !2 = $arr, !3 = $lower, !4 = $v, !5 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   11     3        INIT_FCALL                                               'mb_strtolower'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 'utf-8'
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !3, $6
   12     8      > FE_RESET_R                                       $8      !2, ->33
          9    > > FE_FETCH_R                                       ~9      $8, !4, ->33
         10    >   ASSIGN                                                   !5, ~9
   13    11        INIT_FCALL                                               'var_dump'
         12        CONCAT                                           ~11     !1, '%3D'
         13        CONCAT                                           ~12     ~11, !5
         14        SEND_VAL                                                 ~12
         15        DO_ICALL                                                 
   14    16        IS_NOT_IDENTICAL                                 ~14     !5, !1
         17      > JMPZ_EX                                          ~14     ~14, ->20
         18    >   TYPE_CHECK                                  1020  ~15     !4
         19        BOOL                                             ~14     ~15
         20    > > JMPZ_EX                                          ~14     ~14, ->27
         21    >   INIT_FCALL                                               'mb_strtolower'
         22        SEND_VAR                                                 !4
         23        SEND_VAL                                                 'utf-8'
         24        DO_ICALL                                         $16     
         25        IS_IDENTICAL                                     ~17     !3, $16
         26        BOOL                                             ~14     ~17
         27    > > JMPZ                                                     ~14, ->32
   15    28    >   INIT_FCALL                                               'var_dump'
         29        SEND_VAL                                                 'rm'
         30        DO_ICALL                                                 
   16    31        UNSET_DIM                                                !2, !5
   12    32    > > JMP                                                      ->9
         33    >   FE_FREE                                                  $8
   19    34      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fnb7Nt%3A10%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
195.45 ms | 1400 KiB | 19 Q