Q: trim( $str, "()" ) not working, anyone knows why? trim( $str, "()" ) not working, anyone knows why?
I have also try single quotation marks:
$str = "(abcd...";    
$str = trim( $str, "()" );
echo $str;
// outputs (abcd...

But it is not removing the parenthesis at the beginning and end of string.
Am I doing anything wrong?
Thank you

A: It will remove if braces if they are exactly at the beginning/end. This works 
$str = '(aa)';
echo trim( $str, "()" );

meanwhile this is NOT: 
$str = 'a()a';
echo trim( $str, "()" );

For the second case you can use 
echo str_replace(array( '(', ')' ), '', $str);;


A: approach this as
$hello  = "()Hello World())";
$trimmed = trim($hello, '()');
echo $trimmed;

For more details trim()

A: It was not working because it had blank spaces at the beginning/end. so I run trim($str) first before trim($str, '()') and now it is working like it should be. Thank you!
