3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "Header/Footer"; $special_char_find = array( "!","#","$","%","&","(",")","*","+", ",","-",".","/",":",";","<","=",">", "?","@","[","]","^","{","|","}","~" ); $special_char_replace = array( "c33","c35","c36","c37","c38","c40","c41","c42","c43", "c44","c45","c46","c47","c58","c59","c60","c61","c62", "c63","c64","c91","c93","c94","c123","c124","c125","c126" ); $str = str_replace($special_char_find, $special_char_replace, $str); $str = strtolower(preg_replace("/[^A-Za-z0-9_]/", '', str_replace(' ', '_', trim($str)))); $str = trim($str, "_"); echo $str;

preferences:
29.99 ms | 402 KiB | 5 Q