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

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
isaac_cm
Forum Commoner
Posts: 44
Joined: Wed May 17, 2006 8:47 am

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

Post 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
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

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

Post 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.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

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

Post 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();
(#10850)
isaac_cm
Forum Commoner
Posts: 44
Joined: Wed May 17, 2006 8:47 am

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

Post by isaac_cm »

thanks for replies
Post Reply