3v4l.org

run code in 500+ PHP versions simultaneously
<?php function array_filter_(array $data, callable $callback) { $filtered = []; foreach ($data as $key => $value) { if ($callback($value)) { $filtered[$key] = $value; } } 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/YDZXk
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                              ~4      [0]
   21     7        SEND_VAL                                                     ~4
   17     8        DO_FCALL                                          0  $5      
          9        ASSIGN                                                       !1, $5
   23    10        INIT_FCALL                                                   'var_dump'
         11        SEND_VAR                                                     !1
         12        DO_ICALL                                                     
         13      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YDZXk
function name:  {closure:/in/YDZXk:17}
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 Dynamic Function 0

Function array_filter_:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 12
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/YDZXk
function name:  array_filter_
number of ops:  16
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, ->13
          4    > > FE_FETCH_R                                           ~7      $6, !3, ->13
          5    >   ASSIGN                                                       !4, ~7
    6     6        INIT_DYNAMIC_CALL                                            !1
          7        SEND_VAR_EX                                                  !3
          8        DO_FCALL                                          0  $9      
          9      > JMPZ                                                         $9, ->12
    7    10    >   ASSIGN_DIM                                                   !2, !4
         11        OP_DATA                                                      !3
    5    12    > > JMP                                                          ->4
         13    >   FE_FREE                                                      $6
   10    14      > RETURN                                                       !2
   11    15*     > RETURN                                                       null

End of function array_filter_

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
137.09 ms | 1825 KiB | 10 Q