Вопрос

this is a pretty strange question, but what can i use as quotes in HTML or php or javascript?

I already use ' and " , but i need one more, cause i have javascript INSIDE html INSIDE php.

I need them when i don't use variables, but specific strings...

So.. What can i use as third kind of quote ?

Thanks

Evert

Это было полезно?

Решение

You can use heredoc syntax:

$javascript = <<<EOT
//Enter javascript here

EOT;

Within the heredoc syntax, you can enter single and double quotes. The syntax starts with '<<<' and a unique identifier (in this case 'EOT') that appears nowhere else on you page, and it closes with the same identifIer and a semicolon. It's important that no spaces or anything else occur on the same line as the closing identifier.

For example, you could do the following:

$javascript = <<<EOT
<script type="text/javascript">
    //<![CDATA[
    $(document).ready(function() {
        alert("Hello world!");
    });
    //]]>
</script>

EOT;
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top