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($lista, $chave, $valor){ $filtrados = []; foreach($lista as $item){ if($projeto[$chave] <= $valor){ $filtrados [] = $item; }; }; return $filtrados; }; // $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); print_r($resultado);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OsEEu
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>
   42     1        INIT_FCALL                                               'filtro'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   44     5        INIT_FCALL                                               'print_r'
          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 = 5, Position 2 = 12
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 11
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/OsEEu
function name:  filtro
number of ops:  15
compiled vars:  !0 = $lista, !1 = $chave, !2 = $valor, !3 = $filtrados, !4 = $item, !5 = $projeto
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   21     3        ASSIGN                                                   !3, <array>
   23     4      > FE_RESET_R                                       $7      !0, ->12
          5    > > FE_FETCH_R                                               $7, !4, ->12
   24     6    >   FETCH_DIM_R                                      ~8      !5, !1
          7        IS_SMALLER_OR_EQUAL                                      ~8, !2
          8      > JMPZ                                                     ~9, ->11
   25     9    >   ASSIGN_DIM                                               !3
         10        OP_DATA                                                  !4
   23    11    > > JMP                                                      ->5
         12    >   FE_FREE                                                  $7
   29    13      > RETURN                                                   !3
   30    14*     > RETURN                                                   null

End of function filtro

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.19 ms | 1008 KiB | 15 Q