Page 1 of 1

print variable

Posted: Wed Apr 28, 2010 4:00 pm
by akashiraffee
Hi. I'm totally new to php but have done a lot of web-dev with perl mason, which works in a similar way.

I'm wondering about some "parallel functionality". In a mason file, you can include a variable like this:

Code: Select all

<p><%$var_name%></p>
Right now, with my complete ignorance of php, I having to do this:

Code: Select all

<p><?php printf("%s", $var_name) ?></p>
Which is a lot more long winded. Is there a simpler way to output a variable, al la the mason method?

Re: print variable

Posted: Wed Apr 28, 2010 5:08 pm
by Christopher

Code: Select all

<p><?php echo $var_name) ?></p>
It is still a little longer. If really need shorter then use a template system (or deprecated short tags)