3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = "<script> alert('hi')</script>"; //$b= filter_var($a, FILTER_SANITIZE_STRING); $b= filter_var($a, FILTER_VALIDATE_STRING); echo $b; ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.15, 8.5.0 - 8.5.1
Fatal error: Uncaught Error: Undefined constant "FILTER_VALIDATE_STRING" in /in/sC4Pg:5 Stack trace: #0 {main} thrown in /in/sC4Pg on line 5
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: Use of undefined constant FILTER_VALIDATE_STRING - assumed 'FILTER_VALIDATE_STRING' (this will throw an Error in a future version of PHP) in /in/sC4Pg on line 5 Warning: filter_var() expects parameter 2 to be int, string given in /in/sC4Pg on line 5
Output for 7.2.0 - 7.2.33
Warning: Use of undefined constant FILTER_VALIDATE_STRING - assumed 'FILTER_VALIDATE_STRING' (this will throw an Error in a future version of PHP) in /in/sC4Pg on line 5 Warning: filter_var() expects parameter 2 to be integer, string given in /in/sC4Pg on line 5
Output for 7.1.0 - 7.1.33
Notice: Use of undefined constant FILTER_VALIDATE_STRING - assumed 'FILTER_VALIDATE_STRING' in /in/sC4Pg on line 5 Warning: filter_var() expects parameter 2 to be integer, string given in /in/sC4Pg on line 5
Output for 5.3.16, 5.6.40
Notice: Use of undefined constant FILTER_VALIDATE_STRING - assumed 'FILTER_VALIDATE_STRING' in /in/sC4Pg on line 5 Warning: filter_var() expects parameter 2 to be long, string given in /in/sC4Pg on line 5
Output for 4.3.11
Fatal error: Call to undefined function: filter_var() in /in/sC4Pg on line 5
Process exited with code 255.

preferences:
154.23 ms | 413 KiB | 5 Q