PHP Short Tags

1 | <?php |
2 | $example = 'This is some text that I want in my paragraph.' ; |
3 | ?> |
4 | <html> |
5 | <head> |
6 | </head> |
7 | <body> |
8 | <h1>I love short tags</h1> |
9 | <p> |
10 | < ?php |
11 | echo $example ; |
12 | ?> |
13 | </p> |
14 | </body> |
15 | </html> |
16 | </pre> |
17 | Personally I like to get things done with as little typing and code as possible, so I am not a fan of this. I love my short tags. |
18 | <pre> |
19 | <?php |
20 | $example = 'This is some text that I want in my paragraph.' ; |
21 | ?> |
22 | <html> |
23 | <head> |
24 | </head> |
25 | <body> |
26 | <h1>I love short tags</h1> |
27 | <p> |
28 | < ?= $example ?> |
29 | </p> |
30 | </body> |
31 | </html> |
That will produce the exact same output as the first but much neater and with a little less code.
NOTE: Short tags is something that can be disabled in the php.ini so it is not guaranteed to work but industry standard has short tags enabled.
0 comments:
Post a Comment