I need to include some javascript in my php file but im having difficulty with the quotes inside the javascript
This is the javascript:
<scripttype="text/javascript">
var sc_project = $$$$;
var sc_invisible = $;
var sc_security = "$$$$$$$";
var scJsHost = (("https:" == document.location.protocol) ? "https://secure." : "http://www.")
document.write("<sc" + "ript type='text/javascript' src='" + scJsHost + "statcounter.com/counter/counter.js'></" + "script>");
</script>
I tried
echo {
'<scripttype="text/javascript">
var sc_project = $$$$$$;
var sc_invisible = $;
var sc_security = "$$$$$$";
var scJsHost = (("https:" == document.location.protocol) ? "https://secure." : "http://www.")
document.write("<sc" + "ript' . 'type=\'text/javascript\' src='' . ' + scJsHost + "statcounter.com/counter/counter.js'.'></" + "script>");
</script>';
}
Any way to have this appear on my php page?
Your script tag should be:
Because
typeis an attribute.When you are using quotes in PHP, you can mix quotes for simple things…
And you can escape quotes if it gets more complicated…
So you could use this: