DevChunks

Simple Shortcut to PHP echo – Keep it Neat and Tidy

Try this for a simple way to echo a variable in the midst of your html:

{code type=php}

{/code}

You can also use this to show the return value of a function:

{code type=php}

{/code}

This requires the php directive short_open_tag to be set to 1 (done via php.ini or .htaccess). Most hosts will have this set to 1 by default although there are some that will stop this altogether – keep this in mind if your code is to be widely used.

Share:

Leave a Reply

Your email address will not be published.

More Posts

How to use PHP Type Declarations

PHP has developed into a more strictly typed language in recent years. Type Declarations help with that and are a fairly new addition to PHP,

Iteration

If you have come to JavaScript from a background in Java or C, then you will like the variation on the for loop. It is

Context Object Manipulation

One of the key concepts of JavaScript is the keyword this, which signifies the JavaScript context object. If you write an inner function, you can access

Polymorphic Functions

It is possible to define multiple functions with the same name in JavaScript, and the last one of those that you define will be the