How to remove the first and last specific characters from a string in PHP

1 Answer

0 votes
// remove trailing and leading asterisk '*'

$str = "*hasgdhsj*";
$str = trim($str, "*");
echo $str;


/*
run:

hasgdhsj

*/

 



answered Aug 3, 2015 by avibootz
...