php : echo"", print(), printf()

Posted by marc-andre menard on Stack Overflow See other posts from Stack Overflow or by marc-andre menard
Published on 2009-10-01T15:54:32Z Indexed on 2010/04/23 14:13 UTC
Read the original article Hit count: 263

Filed under:
|
|

Is there a better way to output data to html page with PHP ?

if i like to make a div with some var in php i will write something like that

print ('<div>'.$var.'</div>);

or

echo "'<div>'.$var.'</div>'";

what is the PROPER way to do that ?

or a better way, fill a $tempvar and print it once? like that:

$tempvar = '<div>'.$var.'</div>'
print ($tempvar);

in fact, in real life, the var will be fill with much more !

© Stack Overflow or respective owner

Related posts about php

Related posts about syntax