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);
Output for git.master, git.master_jit
Fatal error: Uncaught ArgumentCountError: Too few arguments to function filtro(), 1 passed in /in/OsEEu on line 42 and exactly 3 expected in /in/OsEEu:20 Stack trace: #0 /in/OsEEu(42): filtro(Array) #1 {main} thrown in /in/OsEEu on line 20
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
28.88 ms | 405 KiB | 5 Q