I am trying to remove whitespace and single quotes from a string.
$string = "'DZ;Algeria;The People's Democratic Republic of Algeria;Algerian' ";
echo trim($string,"'");
In the above string I want to remove single quotes from both ends, but trim only removes the left single quote. The right side single quote remains after trimming.
The output is:
DZ;Algeria;The People's Democratic Republic of Algeria;Algerian'
But I want this:
DZ;Algeria;The People's Democratic Republic of Algeria;Algerian