3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $test = array( 0, '', '0', 1, '1', '1.1', '1a1', '1e1', 'asdf' ); $result = array(); foreach ($test as $val) { $result[] = filter_input($val, FILTER_VALIDATE_FLOAT); } var_dump($test);
based on WohZZ
Output for 7.0.0 - 7.2.6
Warning: filter_input() expects parameter 1 to be integer, string given in /in/75th2 on line 18 Notice: A non well formed numeric value encountered in /in/75th2 on line 18 Warning: filter_input() expects parameter 1 to be integer, string given in /in/75th2 on line 18 array(9) { [0]=> int(0) [1]=> string(0) "" [2]=> string(1) "0" [3]=> int(1) [4]=> string(1) "1" [5]=> string(3) "1.1" [6]=> string(3) "1a1" [7]=> string(3) "1e1" [8]=> string(4) "asdf" }
Output for 5.2.0 - 5.6.28
Warning: filter_input() expects parameter 1 to be long, string given in /in/75th2 on line 18 Notice: A non well formed numeric value encountered in /in/75th2 on line 18 Warning: filter_input() expects parameter 1 to be long, string given in /in/75th2 on line 18 array(9) { [0]=> int(0) [1]=> string(0) "" [2]=> string(1) "0" [3]=> int(1) [4]=> string(1) "1" [5]=> string(3) "1.1" [6]=> string(3) "1a1" [7]=> string(3) "1e1" [8]=> string(4) "asdf" }
Output for 5.0.0 - 5.1.6
Fatal error: Call to undefined function filter_input() in /in/75th2 on line 18
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: filter_input() in /in/75th2 on line 18
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: filter_input() in /in/75th2 on line 18
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: filter_input() in /in/75th2 on line 18