Tips & Tricks: Don’t forget you can break out of php mode

Often when developing we often get stuck in the mindset that we have to do everything in the language we are working with. When it comes to PHP this can sometimes lead to line after line of echo statements that do not contain any code but simply HTML or CSS elements. Due to the very nature of PHP we can however break out of php mode to have these text elements display without endless lines of echoes.

To illustrate lets assume we have a page that contains a lot of static html text we can display this text by closing our php mode having the html formatted text then reopen php mode.

   .... // code
?> // close php mode
   <div> //HTML
<?php  // reopen php mode
// PHP // Tips & Tricks //

Comments & Questions

Add Your Comment