3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php header("Content-type: text/plain charset=UTF-8;"); $in = array( 'meta_data' => 'querysucceful!', 'size' => 15, 'resultset'=> array( array( 'name' => 'resul_1', 'aaaa' => '1a', 'bbbb' => '1b' ), array( 'name' => 'result_2', 'aaaa' => '2a', 'bbbb' => '2b' ), array( 'name' => 'result_3', 'aaaa' => '3a', 'bbbb' => '3b' ) ) ); $filter = array( 'meta_data' => FILTER_SANITIZE_STRING, 'size' => FILTER_SANITIZE_NUMBER_INT, 'resultset' => array('filter' => FILTER_CALLBACK, 'options' => 'filter_result') ); $out = filter_var_array($in, $filter); var_dump($out); function filter_result($result) { var_dump($result); return null; }
Output for 5.2.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
string(7) "resul_1" string(2) "1a" string(2) "1b" string(8) "result_2" string(2) "2a" string(2) "2b" string(8) "result_3" string(2) "3a" string(2) "3b" array(3) { ["meta_data"]=> string(14) "querysucceful!" ["size"]=> string(2) "15" ["resultset"]=> array(3) { [0]=> array(3) { ["name"]=> NULL ["aaaa"]=> NULL ["bbbb"]=> NULL } [1]=> array(3) { ["name"]=> NULL ["aaaa"]=> NULL ["bbbb"]=> NULL } [2]=> array(3) { ["name"]=> NULL ["aaaa"]=> NULL ["bbbb"]=> NULL } } }
Output for 5.0.0 - 5.1.6
Notice: Use of undefined constant FILTER_SANITIZE_STRING - assumed 'FILTER_SANITIZE_STRING' in /in/K4Ln1 on line 30 Notice: Use of undefined constant FILTER_SANITIZE_NUMBER_INT - assumed 'FILTER_SANITIZE_NUMBER_INT' in /in/K4Ln1 on line 31 Notice: Use of undefined constant FILTER_CALLBACK - assumed 'FILTER_CALLBACK' in /in/K4Ln1 on line 32 Fatal error: Call to undefined function filter_var_array() in /in/K4Ln1 on line 35
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Notice: Use of undefined constant FILTER_SANITIZE_STRING - assumed 'FILTER_SANITIZE_STRING' in /in/K4Ln1 on line 30 Notice: Use of undefined constant FILTER_SANITIZE_NUMBER_INT - assumed 'FILTER_SANITIZE_NUMBER_INT' in /in/K4Ln1 on line 31 Notice: Use of undefined constant FILTER_CALLBACK - assumed 'FILTER_CALLBACK' in /in/K4Ln1 on line 32 Fatal error: Call to undefined function: filter_var_array() in /in/K4Ln1 on line 35
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Notice: Use of undefined constant FILTER_SANITIZE_STRING - assumed 'FILTER_SANITIZE_STRING' in /in/K4Ln1 on line 30 Notice: Use of undefined constant FILTER_SANITIZE_NUMBER_INT - assumed 'FILTER_SANITIZE_NUMBER_INT' in /in/K4Ln1 on line 31 Notice: Use of undefined constant FILTER_CALLBACK - assumed 'FILTER_CALLBACK' in /in/K4Ln1 on line 32 Fatal error: Call to undefined function: filter_var_array() in /in/K4Ln1 on line 35
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant FILTER_SANITIZE_STRING - assumed 'FILTER_SANITIZE_STRING' in /in/K4Ln1 on line 30 Notice: Use of undefined constant FILTER_SANITIZE_NUMBER_INT - assumed 'FILTER_SANITIZE_NUMBER_INT' in /in/K4Ln1 on line 31 Notice: Use of undefined constant FILTER_CALLBACK - assumed 'FILTER_CALLBACK' in /in/K4Ln1 on line 32 Fatal error: Call to undefined function: filter_var_array() in /in/K4Ln1 on line 35