I'm adding data from .txt to database with this code:
$dosya=new SplFileObject('veriler.txt');
while(!$dosya->eof())
{
$satir=$dosya ->fgets();
list($name,$section,$initialname)=explode(' ',$satir);
$sth= $baglan->prepare('INSERT INTO tablo1 values (NULL,?,?,?,NULL)');
$sth->bindValue(1,$name,PDO::PARAM_STR);
$sth->bindValue(2,$section,PDO::PARAM_INT);
$sth->bindValue(3,$initialname,PDO::PARAM_STR);
$sth->execute();
}
In the .txt if there is a 1 space between the words, my program is working. But as you can see, there are more than one space in my txt file. How can i delete/remove multiple spaces in .txt file? If you can show me in my codes, i will be glad. Thank you.