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
Notice: Use of undefined constant FILTER_CALLBACK - assumed 'FILTER_CALLBACK' in /in/781o8 on line 13 Notice: Use of undefined constant FILTER_FORCE_ARRAY - assumed 'FILTER_FORCE_ARRAY' in /in/781o8 on line 14 Notice: Use of undefined constant FILTER_VALIDATE_INT - assumed 'FILTER_VALIDATE_INT' in /in/781o8 on line 19 Notice: Use of undefined constant FILTER_VALIDATE_EMAIL - assumed 'FILTER_VALIDATE_EMAIL' in /in/781o8 on line 27 Fatal error: Call to undefined function filter_var_array() in /in/781o8 on line 30
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Notice: Use of undefined constant FILTER_CALLBACK - assumed 'FILTER_CALLBACK' in /in/781o8 on line 13 Notice: Use of undefined constant FILTER_FORCE_ARRAY - assumed 'FILTER_FORCE_ARRAY' in /in/781o8 on line 14 Notice: Use of undefined constant FILTER_VALIDATE_INT - assumed 'FILTER_VALIDATE_INT' in /in/781o8 on line 19 Notice: Use of undefined constant FILTER_VALIDATE_EMAIL - assumed 'FILTER_VALIDATE_EMAIL' in /in/781o8 on line 27 Fatal error: Call to undefined function: filter_var_array() in /in/781o8 on line 30
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Notice: Use of undefined constant FILTER_CALLBACK - assumed 'FILTER_CALLBACK' in /in/781o8 on line 13 Notice: Use of undefined constant FILTER_FORCE_ARRAY - assumed 'FILTER_FORCE_ARRAY' in /in/781o8 on line 14 Notice: Use of undefined constant FILTER_VALIDATE_INT - assumed 'FILTER_VALIDATE_INT' in /in/781o8 on line 19 Notice: Use of undefined constant FILTER_VALIDATE_EMAIL - assumed 'FILTER_VALIDATE_EMAIL' in /in/781o8 on line 27 Fatal error: Call to undefined function: filter_var_array() in /in/781o8 on line 30
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant FILTER_CALLBACK - assumed 'FILTER_CALLBACK' in /in/781o8 on line 13 Notice: Use of undefined constant FILTER_FORCE_ARRAY - assumed 'FILTER_FORCE_ARRAY' in /in/781o8 on line 14 Notice: Use of undefined constant FILTER_VALIDATE_INT - assumed 'FILTER_VALIDATE_INT' in /in/781o8 on line 19 Notice: Use of undefined constant FILTER_VALIDATE_EMAIL - assumed 'FILTER_VALIDATE_EMAIL' in /in/781o8 on line 27 Fatal error: Call to undefined function: filter_var_array() in /in/781o8 on line 30