PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Software\Apache2\htdocs\inter\replacer\definers\replace_del_news.php on line 7
How come? I have singe quotes between double ones.
Yes, I had this solution in mind as well and now the string gets passed, but is it ok to use double quotes when retrieving an array element? I've always used single quotes for string keys and no quotes for numeric keys.
Convention is to always use single quotes for arrays but I think it is an acceptable exception in this case to make the thing more readable without having to concatenate different things.
I think you have misunderstood him coder. While your method may be correct (although I'm not sure, never really tried it that way... ?), I think he was meaning something like this :
//Double Quotes Array for $row
$replace=$replacer->ReplaceGlobalValue('ItemValue', '<?php echo $row["headline"]; ?>');
//Single Quote Array for $row
$replace=$replacer->ReplaceGlobalValue('ItemValue', '<?php echo $row['headline']; ?>');
both are very valid and it's all about your choice of preference. It pretty much falls in the same like of echoing with single or double quotes. Both work the same except double quotes will allow you a little more control over the string should you decide you need to insert new line characters or the like.
//Single Quote Array for $row
$replace=$replacer->ReplaceGlobalValue('ItemValue', '<?php echo $row['headline']; ?>');
Will not work as you are closing the quoted string (guess T_STRING error). Bear in mind he wanted the string, not the value. Double quotes work for arrays although another solution would be to escape the $ with a backslash and use double quotes around the whole thing.
//Single Quote Array for $row
$replace=$replacer->ReplaceGlobalValue('ItemValue', '<?php echo $row['headline']; ?>');
both are very valid and it's all about your choice of preference. It pretty much falls in the same like of echoing with single or double quotes. Both work the same except double quotes will allow you a little more control over the string should you decide you need to insert new line characters or the like.
Actually that one is not valid, you forgot to escape your single quotes