I need to change the word just after Maildir, in this exemple NULL of a line : (the word NULL can be any word.)
[3]=>
string(42) "SPAM
* ^Subject: \[SPAM\].*
Maildir/.NULL/"
I use this code :
if($filecontent = file_get_contents($filename)){
$repertoire = "SPAM";
$tab = explode("#", trim($filecontent));
$tab[3] = preg_replace("#Maildir/*#", 'Maildir/.'.$repertoire.'/', $tab[3]);
var_dump($tab);
But i have
string(48) "SPAM
* ^Subject: \[SPAM\].*
Maildir/.NULL/.SPAM/"
How can i change that in Maildir/.SPAM because .NULL is in excess.
string(48) "SPAM
* ^Subject: \[SPAM\].*
Maildir/.SPAM/"