3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php var_dump(filter_var('example.com', FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_OPTIONAL)); var_dump(filter_var('//example.com', FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED)); var_dump(filter_var('/index.php', FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_OPTIONAL|FILTER_FLAG_HOST_OPTIONAL)); var_dump(filter_var('/index.php', FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED|FILTER_FLAG_HOST_REQUIRED));
based on aHOqo
Output for 7.3.0beta1 - 7.3.0rc3
Warning: Use of undefined constant FILTER_FLAG_SCHEME_OPTIONAL - assumed 'FILTER_FLAG_SCHEME_OPTIONAL' (this will throw an Error in a future version of PHP) in /in/5YHJH on line 3 bool(false) Deprecated: filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated in /in/5YHJH on line 4 bool(false) Warning: Use of undefined constant FILTER_FLAG_SCHEME_OPTIONAL - assumed 'FILTER_FLAG_SCHEME_OPTIONAL' (this will throw an Error in a future version of PHP) in /in/5YHJH on line 5 Warning: Use of undefined constant FILTER_FLAG_HOST_OPTIONAL - assumed 'FILTER_FLAG_HOST_OPTIONAL' (this will throw an Error in a future version of PHP) in /in/5YHJH on line 5 bool(false) Deprecated: filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated in /in/5YHJH on line 6 bool(false)
Output for 7.2.0 - 7.3.0alpha1
Warning: Use of undefined constant FILTER_FLAG_SCHEME_OPTIONAL - assumed 'FILTER_FLAG_SCHEME_OPTIONAL' (this will throw an Error in a future version of PHP) in /in/5YHJH on line 3 bool(false) bool(false) Warning: Use of undefined constant FILTER_FLAG_SCHEME_OPTIONAL - assumed 'FILTER_FLAG_SCHEME_OPTIONAL' (this will throw an Error in a future version of PHP) in /in/5YHJH on line 5 Warning: Use of undefined constant FILTER_FLAG_HOST_OPTIONAL - assumed 'FILTER_FLAG_HOST_OPTIONAL' (this will throw an Error in a future version of PHP) in /in/5YHJH on line 5 bool(false) bool(false)
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.1.20
Notice: Use of undefined constant FILTER_FLAG_SCHEME_OPTIONAL - assumed 'FILTER_FLAG_SCHEME_OPTIONAL' in /in/5YHJH on line 3 bool(false) bool(false) Notice: Use of undefined constant FILTER_FLAG_SCHEME_OPTIONAL - assumed 'FILTER_FLAG_SCHEME_OPTIONAL' in /in/5YHJH on line 5 Notice: Use of undefined constant FILTER_FLAG_HOST_OPTIONAL - assumed 'FILTER_FLAG_HOST_OPTIONAL' in /in/5YHJH on line 5 bool(false) bool(false)