3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $r = array(); $org = ' valid_The Cat 1-Name%'.PHP_EOL; $r[] = $org; $clear = strip_tags($org); $clear = html_entity_decode($clear); $clear = urldecode($clear); $clear = preg_replace('/[^A-Za-z0-9]/', ' ', $clear); $clear = preg_replace('/ +/', ' ', $clear); $filter = filter_var($clear, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH); $r[] = $filter; $trim = trim($filter); $r[] = $trim; $mv_space = str_replace(' ', '-', $trim); $r[] = $mv_space; $rm_w = str_replace(array("\n", "\r", "\t"), '', $mv_space); $r[] = $rm_w; $lower = strtolower($rm_w); $r[] = $lower; var_dump($r);
Output for 5.2.0 - 7.1.0
array(6) { [0]=> string(23) " valid_The Cat 1-Name% " [1]=> string(22) " valid The Cat 1 Name " [2]=> string(20) "valid The Cat 1 Name" [3]=> string(20) "valid-The-Cat-1-Name" [4]=> string(20) "valid-The-Cat-1-Name" [5]=> string(20) "valid-the-cat-1-name" }
Output for 5.0.2 - 5.1.6
Fatal error: Call to undefined function filter_var() in /in/XmMtO on line 22
Process exited with code 255.
Output for 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/XmMtO on line 6 Fatal error: Call to undefined function filter_var() in /in/XmMtO on line 22
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: filter_var() in /in/XmMtO on line 22
Process exited with code 255.
Output for 4.3.10 - 4.4.4
Fatal error: Call to undefined function: filter_var() in /in/XmMtO on line 22
Process exited with code 255.
Output for 4.3.2 - 4.3.9
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/XmMtO on line 6 Fatal error: Call to undefined function: filter_var() in /in/XmMtO on line 22
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/XmMtO on line 6 Fatal error: Call to undefined function: filter_var() in /in/XmMtO on line 22