3v4l.org

run code in 300+ PHP versions simultaneously
<?php $projetos = [ [ "title" => "PHP - O começo", "ano" => 2024, ], [ "title" => "JavaScript - o fim", "ano" => 2020, ], [ "title" => "HTML - O MEIO", "ano" => 2025, ], ]; function filtro($projetos){ $projetosFiltrados = []; foreach($projetos as $projeto){ if($projeto["title"] < 2024){ $projetosFiltrados [] = $projeto; }; }; return $projetosFiltrados; }; // $before25 = array_filter($projetos, function($projeto){ // return $projeto["ano"] <= 2024; // }); // $containsJS = array_filter($before25, function($projeto){ // return str_contains($projeto["title"], "JavaScript"); // }); $resultado = filtro($projetos); var_dump($resultado);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JSr9F
function name:  (null)
number of ops:  9
compiled vars:  !0 = $projetos, !1 = $resultado
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   41     1        INIT_FCALL                                               'filtro'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   43     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function filtro:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/JSr9F
function name:  filtro
number of ops:  13
compiled vars:  !0 = $projetos, !1 = $projetosFiltrados, !2 = $projeto
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   21     1        ASSIGN                                                   !1, <array>
   23     2      > FE_RESET_R                                       $4      !0, ->10
          3    > > FE_FETCH_R                                               $4, !2, ->10
   24     4    >   FETCH_DIM_R                                      ~5      !2, 'title'
          5        IS_SMALLER                                               ~5, 2024
          6      > JMPZ                                                     ~6, ->9
   25     7    >   ASSIGN_DIM                                               !1
          8        OP_DATA                                                  !2
   23     9    > > JMP                                                      ->3
         10    >   FE_FREE                                                  $4
   29    11      > RETURN                                                   !1
   30    12*     > RETURN                                                   null

End of function filtro

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.87 ms | 1008 KiB | 15 Q