RMTWeb

View Original

PHP write to screen without using echo

I have been slowly learning PHP for a while now, and whilst I still prefer ASP.Net with its nicely organised code-behind pages and button click methods, there is something very nice about just integrating code and html.One of the annoyances I had was that in order to (for example) display a variable on the screen within my html, I had to type:<p><?php echo $VariableName; ?></p>..but there is an easier way that I have just discovered and thought I would share:<p><?=$VariableName?></p>....no semi-colons, no <?php, no echo! Much faster to type!Obviously you dont need the <p> and </p> tags, they are just there to illustrate that it can be used within HTML. I've used this lots in a new website that I have been working on in my free time: http://www.chriswilsonartist.com