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 ( "age" => array ( "filter"=>FILTER_VALIDATE_INT, "flags"=>FILTER_FORCE_ARRAY, "options"=>array ( "min_range"=>1, "max_range"=>120 ) ),"name" => array ( "filter"=>FILTER_CALLBACK, "flags"=>FILTER_FORCE_ARRAY, "options"=>"ucwords" ), "email"=> FILTER_VALIDATE_EMAIL, ); print_r(filter_var_array($arr, $filters)); ?>
Output for 5.2.0 - 7.1.0
Array ( [age] => Array ( [0] => 41 ) [name] => Peter Griffin [email] => peter@example.com )
Output for 5.0.0 - 5.1.6
Notice: Use of undefined constant FILTER_VALIDATE_INT - assumed 'FILTER_VALIDATE_INT' in /in/eDSFY on line 14 Notice: Use of undefined constant FILTER_FORCE_ARRAY - assumed 'FILTER_FORCE_ARRAY' in /in/eDSFY on line 15 Notice: Use of undefined constant FILTER_CALLBACK - assumed 'FILTER_CALLBACK' in /in/eDSFY on line 23 Notice: Use of undefined constant FILTER_FORCE_ARRAY - assumed 'FILTER_FORCE_ARRAY' in /in/eDSFY on line 24 Notice: Use of undefined constant FILTER_VALIDATE_EMAIL - assumed 'FILTER_VALIDATE_EMAIL' in /in/eDSFY on line 27 Fatal error: Call to undefined function filter_var_array() in /in/eDSFY on line 30
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Notice: Use of undefined constant FILTER_VALIDATE_INT - assumed 'FILTER_VALIDATE_INT' in /in/eDSFY on line 14 Notice: Use of undefined constant FILTER_FORCE_ARRAY - assumed 'FILTER_FORCE_ARRAY' in /in/eDSFY on line 15 Notice: Use of undefined constant FILTER_CALLBACK - assumed 'FILTER_CALLBACK' in /in/eDSFY on line 23 Notice: Use of undefined constant FILTER_FORCE_ARRAY - assumed 'FILTER_FORCE_ARRAY' in /in/eDSFY on line 24 Notice: Use of undefined constant FILTER_VALIDATE_EMAIL - assumed 'FILTER_VALIDATE_EMAIL' in /in/eDSFY on line 27 Fatal error: Call to undefined function: filter_var_array() in /in/eDSFY on line 30
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Notice: Use of undefined constant FILTER_VALIDATE_INT - assumed 'FILTER_VALIDATE_INT' in /in/eDSFY on line 14 Notice: Use of undefined constant FILTER_FORCE_ARRAY - assumed 'FILTER_FORCE_ARRAY' in /in/eDSFY on line 15 Notice: Use of undefined constant FILTER_CALLBACK - assumed 'FILTER_CALLBACK' in /in/eDSFY on line 23 Notice: Use of undefined constant FILTER_FORCE_ARRAY - assumed 'FILTER_FORCE_ARRAY' in /in/eDSFY on line 24 Notice: Use of undefined constant FILTER_VALIDATE_EMAIL - assumed 'FILTER_VALIDATE_EMAIL' in /in/eDSFY on line 27 Fatal error: Call to undefined function: filter_var_array() in /in/eDSFY on line 30
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant FILTER_VALIDATE_INT - assumed 'FILTER_VALIDATE_INT' in /in/eDSFY on line 14 Notice: Use of undefined constant FILTER_FORCE_ARRAY - assumed 'FILTER_FORCE_ARRAY' in /in/eDSFY on line 15 Notice: Use of undefined constant FILTER_CALLBACK - assumed 'FILTER_CALLBACK' in /in/eDSFY on line 23 Notice: Use of undefined constant FILTER_FORCE_ARRAY - assumed 'FILTER_FORCE_ARRAY' in /in/eDSFY on line 24 Notice: Use of undefined constant FILTER_VALIDATE_EMAIL - assumed 'FILTER_VALIDATE_EMAIL' in /in/eDSFY on line 27 Fatal error: Call to undefined function: filter_var_array() in /in/eDSFY on line 30