3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function sanipath( $path ) { global $patternsPath; global $styleguidePath; $saniPath = str_replace( "../", "", $path ); $saniPath = str_replace( ";", "", $saniPath ); $saniPath = htmlspecialchars( $saniPath ); $saniFile = preg_replace( "/\.[^$]*/", "", $saniPath); $ret = $saniFile . ".html"; return $ret; } var_dump(sanipath('/files/../../../var/www/config.ini'));
Output for 4.3.0 - 7.2.0
string(26) "/files/var/www/config.html"