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) { 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/XhFDv
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%2FXhFDv%3A10%240'
          4        BIND_LEXICAL                                             ~2, !0
   17     5        SEND_VAL                                                 ~2
          6        DO_ICALL                                                 
   18     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

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

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.12 ms | 1400 KiB | 19 Q