3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $type = 'login'; $data = 'wolf'; echo FormValid($data,$type); function FormValid($data,$type){ switch($type){ case 'login': $edit = preg_replace("/[^A-Za-z0-9]/u", "", $data); break; case 'password': $edit = preg_replace("/[^A-Za-z0-9-_.,]/", "", $data); break; } if($data != $edit){ return false; } else{ return $data; }; }
Output for 4.3.0 - 7.1.0
wolf