Page 1 of 1

wich is better print 'html' or html with <?php ?> inside ?

Posted: Wed Jul 08, 2009 2:23 pm
by isaac_cm
Hello,
I found two type of php sites one print all html like that:

print '<div> ....

and other is html and then embed php inside with <?php ?>

which is better for developer ? faster ? and easier ? or when I should use one method over another ?

Thanks

Re: wich is better print 'html' or html with <?php ?> inside ?

Posted: Wed Jul 08, 2009 7:25 pm
by califdon
It doesn't really make much difference, except in ease of reading the code. In principle, requiring the PHP parser to read more bytes is probably slower, but I doubt that you could measure the difference.

Re: wich is better print 'html' or html with <?php ?> inside ?

Posted: Wed Jul 08, 2009 7:39 pm
by Christopher
I think in general you should only be using echo/print and embedding PHP in HTML in templates. Otherwise the only print would be:

Code: Select all

echo $template->render();

Re: wich is better print 'html' or html with <?php ?> inside ?

Posted: Wed Jul 08, 2009 8:34 pm
by isaac_cm
thanks for replies