Is there a way to easily trim out specific extra characters from left and right of a php string along with extra spaces and break lines e.g.
$str = " ,apple,orrange,banana, ";
$str = "|apple|orrange|banana||";
trim() function has second parameter Character Mask which can be used in your case.
$fieldValue = ",|banana,orange,Yahooo||| "; $v = trim($fieldValue," \t\n\r\0\x0B,-|"); echo $v;
The output will be