3v4l.org

run code in 150+ 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.1.0
string(12) "/files/.html"