Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use inverted commas in the echo function in PHP?

Tags:

php

echo

How do I use inverted commas in the echo function in PHP?

echo "<script type="text/javascript">";

doesnt work well.

Thank you!

like image 570
iTayb Avatar asked May 19 '10 22:05

iTayb


2 Answers

Escape them with backslashes:

echo "<script type=\"text/javascript\">";

Alternatively, you can use a different set of quotes:

echo '<script type="text/javascript">';

Or, HEREDOC syntax:

echo <<<END
<script type="text/javascript">;
END;
like image 136
Amber Avatar answered Sep 20 '22 09:09

Amber


echo "<script type=\"text/javascript\">";
like image 40
serg Avatar answered Sep 23 '22 09:09

serg