Jump to content

What to do when you run out of parameter notations? ie. " and '


phpfreak101

Recommended Posts

Okay.. what do i do in a situation such as this..

Lets say you echo an HTML tag and inside the "onclick event, you want to call a javascript function and pass a variable to it.

you end up like this
[code]
echo "<a href='blah.com' onclick = 'function(
[/code]
Now this is where i'm stuck if i use ' it closes my onclick block of code and if i use " it closes my echo block of code
[code=php:0]
echo <<<END
This uses the "here document" syntax to output
multiple lines with $variable interpolation. Note
that the here document terminator must appear on a
line with just a semicolon. no extra whitespace!
END;
[/code]

Will also work.
(from the PHP manual)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.