string - How to use single quotes within double quotes in PHP? -


creating link in php:

echo "<a href=\"$currentfile?rowid=$row['id']\">click here</a>"; 

this throws error: parse error: parse error, expecting 't_string' or 't_variable' or 't_num_string'. how can this?

also, mixing single , double quotes, , escaping double quotes reduces readability , generates errors. there better way create quotes syntax, %q() in ruby?

working php 5.2.8.

the problem array variable interpolation. syntax either

"$row[id]" 

or

"{$row['id']}" 

so:

"<a href=\"$currentfile?rowid=$row[id]\">click here</a>" 

see http://php.net/manual/en/language.types.string.php#language.types.string.parsing.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -