jcadima
9/21/2016 - 3:28 PM

Remove array of unwanted characters

Remove array of unwanted characters


<?php
/*
this text alone will display: There are 12\' in-a-foot
applying these strtr function will remove the  \ and replace - with 
a single space,
you can add more unwanted characters to be removed
*/


$remove = array( "\\" => "", "-" => " " );
echo strtr("There are 12' in-a-foot", $remove ) ;