3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_filter_(array $data, callable $callback) { $filtered = []; foreach ($data as $key => $value) { if ($callback($value)) { $filtered[$key] = $data[$key]; } } return $filtered; } $data = ['foo', 'bar']; var_dump($data); $filtered = array_filter_($data, function (&$value) { $value = (bool) $value; return true; }); var_dump($filtered);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7OgqC
function name:  (null)
number of ops:  14
compiled vars:  !0 = $data, !1 = $filtered
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, <array>
   15     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   17     4        INIT_FCALL                                               'array_filter_'
          5        SEND_VAR                                                 !0
          6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F7OgqC%3A17%240'
   21     7        SEND_VAL                                                 ~4
          8        DO_FCALL                                      0  $5      
   17     9        ASSIGN                                                   !1, $5
   23    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function array_filter_:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 14
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 13
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/7OgqC
function name:  array_filter_
number of ops:  17
compiled vars:  !0 = $data, !1 = $callback, !2 = $filtered, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        ASSIGN                                                   !2, <array>
    5     3      > FE_RESET_R                                       $6      !0, ->14
          4    > > FE_FETCH_R                                       ~7      $6, !3, ->14
          5    >   ASSIGN                                                   !4, ~7
    6     6        INIT_DYNAMIC_CALL                                        !1
          7        SEND_VAR_EX                                              !3
          8        DO_FCALL                                      0  $9      
          9      > JMPZ                                                     $9, ->13
    7    10    >   FETCH_DIM_R                                      ~11     !0, !4
         11        ASSIGN_DIM                                               !2, !4
         12        OP_DATA                                                  ~11
    5    13    > > JMP                                                      ->4
         14    >   FE_FREE                                                  $6
   10    15      > RETURN                                                   !2
   11    16*     > RETURN                                                   null

End of function array_filter_

Function %00%7Bclosure%7D%2Fin%2F7OgqC%3A17%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7OgqC
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        BOOL                                             ~1      !0
          2        ASSIGN                                                   !0, ~1
   20     3      > RETURN                                                   <true>
   21     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F7OgqC%3A17%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.05 ms | 1403 KiB | 16 Q