I'm trying to remove spaces from string but only from beggining and end of the string. Everythink work fine but after insert string to database there is no spaces but in the same place is "�".
Here is my code:
$synonimy = $_POST['fsynoms'];
$synonimyPodzielone = explode( ',', $synonimy );
for($k=0; $k < count($synonimyPodzielone); $k++)
{
for($m=0; $m<strlen($synonimyPodzielone[$k]);$m++)
{
if($synonimyPodzielone[$k][$m]==" ")
{
$synonimyPodzielone[$k][$m]="";
}
else
{
break;
}
}
}
I have also tryied with str_replace trim and same problem.
Any idea how to do that?