how to replace all special characters except underscore and period in php?

[et_pb_section admin_label=”section”]
[et_pb_row admin_label=”row”]
[et_pb_column type=”4_4″][et_pb_text admin_label=”Text”]

how to replace all special characters except underscore and period in PHP?

<?php 
            $string="a quick borown fox jump over the lazy dog & ( jkl/)-ov";
            echo $string = preg_replace('/[^a-zA-Z0-9_.]/', '-', strtolower($string));

?>

 [/et_pb_text][/et_pb_column]
[/et_pb_row]
[/et_pb_section]

1 thought on “how to replace all special characters except underscore and period in php?”

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top