3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arr = array ( "name" => "peter griffin", "age" => "41", "email" => "peter@example.com", ); $filters = array ( "name" => array ( "filter"=>FILTER_CALLBACK, "flags"=>FILTER_FORCE_ARRAY, "options"=>"ucwords" ), "age" => array ( "filter"=>FILTER_VALIDATE_INT, "options"=>array ( "min_range"=>1, "max_range"=>120 ) ), "email"=> FILTER_VALIDATE_EMAIL, ); print_r(filter_var_array($arr, $filters)); ?>
Output for 5.2.0 - 5.6.28, 7.0.0 - 7.1.0
Array ( [name] => Peter Griffin [age] => 41 [email] => peter@example.com )
Output for hhvm-3.10.0 - 3.12.0
Array ( [name] => Array ( [0] => Peter Griffin ) [age] => 41 [email] => peter@example.com )
Output for 5.0.0 - 5.1.6
<br /> <b>Fatal error</b>: Call to undefined function filter_var_array() in <b>/in/sgHkI</b> on line <b>29</b><br />
Process exited with code 255.
Output for 4.4.5 - 4.4.9
<br /> <b>Fatal error</b>: Call to undefined function: filter_var_array() in <b>/in/sgHkI</b> on line <b>29</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.4.4
<br /> <b>Fatal error</b>: Call to undefined function: filter_var_array() in <b>/in/sgHkI</b> on line <b>29</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<br /> <b>Fatal error</b>: Call to undefined function: filter_var_array() in <b>/in/sgHkI</b> on line <b>29</b><br />