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($i, $k); if ($i !== $k && $v !== null && $lower === mb_strtolower($v, 'utf-8')) { $item = null; } } }); var_dump($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7PSEO
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%2F7PSEO%3A10%240'
          4        BIND_LEXICAL                                             ~2, !0
   18     5        SEND_VAL                                                 ~2
          6        DO_ICALL                                                 
   19     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F7PSEO%3A10%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 29
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 29
Branch analysis from position: 10
2 jumps found. (Code = 46) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 26
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 28
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 28
Branch analysis from position: 26
Branch analysis from position: 19
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/7PSEO
function name:  {closure}
number of ops:  31
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, ->29
          9    > > FE_FETCH_R                                       ~9      $8, !4, ->29
         10    >   ASSIGN                                                   !5, ~9
   13    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !5
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                                 
   14    15        IS_NOT_IDENTICAL                                 ~12     !5, !1
         16      > JMPZ_EX                                          ~12     ~12, ->19
         17    >   TYPE_CHECK                                  1020  ~13     !4
         18        BOOL                                             ~12     ~13
         19    > > JMPZ_EX                                          ~12     ~12, ->26
         20    >   INIT_FCALL                                               'mb_strtolower'
         21        SEND_VAR                                                 !4
         22        SEND_VAL                                                 'utf-8'
         23        DO_ICALL                                         $14     
         24        IS_IDENTICAL                                     ~15     !3, $14
         25        BOOL                                             ~12     ~15
         26    > > JMPZ                                                     ~12, ->28
   15    27    >   ASSIGN                                                   !0, null
   12    28    > > JMP                                                      ->9
         29    >   FE_FREE                                                  $8
   18    30      > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.8 ms | 1400 KiB | 19 Q