NewWebDesigner
asked on
concatenating strings in PHP
I need help concatenating this string. Currently I am getting an error message.
echo "<div class=\"searchResults\" onclick=\"popUp('$gmail','" . echo $r++ . ")\">";
Or this:
echo "<div class=\"searchResults\" onclick=\"popUp('".$gmail."','" . echo $r++; . ")\">";
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
All those quotes and nested instructions are hard to understand. Suggest you use one instruction per line and try to learn about HEREDOC notation - much easier to get right the first time ;-)
http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
Maybe you want something like this?
http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
Maybe you want something like this?
$str = <<<ENDSTRING
<div class="searchResults" onclick="popUp('$gmail','$r++')">
ENDSTRING;
echo $str;
Thanks for the points!
echo "<div class=\"searchResults\" onclick=\"popUp('$gmail','