3v4l.org

run code in 300+ PHP versions simultaneously
<?php $items = [ 'some', 'test', 'stuff', 1, ]; $filtered = array_filter($items, function ($item) { return is_string($item); }); $capitalized = array_map(function ($item) { return strtoupper($item); }, $filtered); $result = array_reduce($capitalized, function ($carry, $item) { return $carry . $item; }); print_r($result); $result = ''; foreach ($items as $item) { if (is_string($item)) { $result .= strtoupper($item); } } print_r($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 32
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 32
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 31
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 31
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/nRkvn
function name:  (null)
number of ops:  37
compiled vars:  !0 = $items, !1 = $filtered, !2 = $capitalized, !3 = $result, !4 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        INIT_FCALL                                               'array_filter'
          2        SEND_VAR                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FnRkvn%3A10%240'
   12     4        SEND_VAL                                                 ~6
          5        DO_ICALL                                         $7      
   10     6        ASSIGN                                                   !1, $7
   14     7        INIT_FCALL                                               'array_map'
          8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FnRkvn%3A14%241'
   16     9        SEND_VAL                                                 ~9
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $10     
   14    12        ASSIGN                                                   !2, $10
   18    13        INIT_FCALL                                               'array_reduce'
         14        SEND_VAR                                                 !2
         15        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FnRkvn%3A18%242'
   20    16        SEND_VAL                                                 ~12
         17        DO_ICALL                                         $13     
   18    18        ASSIGN                                                   !3, $13
   22    19        INIT_FCALL                                               'print_r'
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                                 
   24    22        ASSIGN                                                   !3, ''
   25    23      > FE_RESET_R                                       $17     !0, ->32
         24    > > FE_FETCH_R                                               $17, !4, ->32
   26    25    >   TYPE_CHECK                                   64          !4
         26      > JMPZ                                                     ~18, ->31
   27    27    >   INIT_FCALL                                               'strtoupper'
         28        SEND_VAR                                                 !4
         29        DO_ICALL                                         $19     
         30        ASSIGN_OP                                     8          !3, $19
   25    31    > > JMP                                                      ->24
         32    >   FE_FREE                                                  $17
   31    33        INIT_FCALL                                               'print_r'
         34        SEND_VAR                                                 !3
         35        DO_ICALL                                                 
         36      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FnRkvn%3A10%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nRkvn
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        TYPE_CHECK                                   64  ~1      !0
          2      > RETURN                                                   ~1
   12     3*     > RETURN                                                   null

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

Function %00%7Bclosure%7D%2Fin%2FnRkvn%3A14%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nRkvn
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        INIT_FCALL                                               'strtoupper'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   16     5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FnRkvn%3A14%241

Function %00%7Bclosure%7D%2Fin%2FnRkvn%3A18%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nRkvn
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $carry, !1 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   19     2        CONCAT                                           ~2      !0, !1
          3      > RETURN                                                   ~2
   20     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FnRkvn%3A18%242

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.91 ms | 1400 KiB | 23 Q