html - Embedded PHP, cannot stop? -


I'm just a little confused. I have this code:

  & lt ;? Php $ this- & gt; Head (? & Gt; style = type = "text / css" & gt; .error {background-color: # ccc; range: 1px solid # 999; padding: 10px; width: 500px;} & lt; / Style> 
Php); ? & Gt;

I was confident that you can do this: It is very similar:

  & lt ;? Php if (true) {? & Gt; Hey & lt ;? Php}? & Gt; An error actually occurs:  

Parse error: syntax error, unexpected ';', expected '' 'in file.php on line 1 (Line 1 of code)

How can I fix this?

Use heredoc if you are trying to pass html as a variable .

  $ var = & lt; & Lt; & Lt; HTML & lt; Style type = "text / css" & gt; .error {background-color: #ccc; Border: 1px solid # 999; Padding: 10px; Width: 500px; } & Lt; / Style & gt; Html; $ This- & gt; Head ($ var);   

You can not do this:

  $ variable =? & Gt; & Lt; P & gt; Omgwtfbbq & lt; / P & gt; & Lt ;;   

This is not just a valid syntax.

INSEAD, you can enclose it with a quote (one or two) $ variable = "& lt; p> omgwtfbbq Gt; ";

Comments