Can't assign empty string to string offset
As per bug # 71572 it is not allowed to assign an empty string. Then use:
substr(fDomains,1); //like Kris Roofe wrote;
or use solutions like this:
$fDomainsTmp = $fDomains;
for($x = 0 ; $x < length($fDomains); $x ++){
if(condition character allow in string){
$fDomainsTmp .= $fDomains[$x];
}
}
$fDomains = $fDomainsTmp;
source to share
Either ($fDomains = "";)
it ($fDomains[0] = "";)
is wrong, but without seeing the rest of the code, it is impossible to tell that it is wrong.
If $fDomains
is a string, then the assignment will $fDomains=''
empty its contents. If $fDomains
is an array, it must be initialized $fDomains=array()
instead of $fDomains=""
, and $fDomains[0]=''
is the correct way to clear the string value of the first element of the array.
In fact, both of the assignments you illustrated in your comment (as reproduced at the top of this answer) are wrong - there should be no semicolon ( ;
) at the end of the parenthesized expression, and unless you have a string that PHP should interpret ( e.g. for built-in variables or escape sequences), you should use single quotes instead of double quotes - should be . ="";
=''
source to share