It's better HTML in PHP or the opposite

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
MicroBoy
Forum Contributor
Posts: 112
Joined: Sat Mar 14, 2009 5:16 pm

It's better HTML in PHP or the opposite

Post by MicroBoy »

I am constructing a PHP Web Site, and I have some tables and forms and I want to know if it's better to use HTML inside PHP OR PHP inside HTML? Because the values of the tables and forms have to be variables. I would like to know which way the page will work faster?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: It's better HTML in PHP or the opposite

Post by requinix »

It's just about the same either way. And when people start touting the "it's more efficient/faster/whatever to do X than Y" know that it's a matter of a small amount of time and is negligible compared to the runtime of the entire script.

Try them both and pick whichever you like more.
MicroBoy
Forum Contributor
Posts: 112
Joined: Sat Mar 14, 2009 5:16 pm

Re: It's better HTML in PHP or the opposite

Post by MicroBoy »

Ok thanks for all, Don't you think that a little slow of speed in a large php system can have bad effects?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: It's better HTML in PHP or the opposite

Post by requinix »

If the only concern was about speed then yes, but 99% of the time people sacrifice readability and maintainability to gain a tiny bit of speed and those are much more important than the microseconds saved.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Re: It's better HTML in PHP or the opposite

Post by Luke »

I agree with tasairis 100%. One of the biggest benefits of PHP is that you really don't have to worry too much about optimization until it becomes an obvious problem. People call it "premature optimization". When you spend more time trying to make a site as fast as possible instead of making it as easy to work on and extend as possible.
MicroBoy
Forum Contributor
Posts: 112
Joined: Sat Mar 14, 2009 5:16 pm

Re: It's better HTML in PHP or the opposite

Post by MicroBoy »

Thanks a lot for your replies I'm really thankful.
Post Reply