+ 1

Php or Html?

Hi, I am a very beginner in web development, and I am wondering: how to choose between php or html to built a website? May php bring more fonctions or does it complex the code? Why choose php when you can built everything with html? In which cases php will be more pertinent than html? Thank you in advance for you answers!

24th Nov 2018, 6:13 PM
luzdeluna
luzdeluna - avatar
4 Réponses
+ 8
Well, the website you get with HTML is static, it's basically always the same, you cannot do much with it. If you want your users to login or leave comments on your site or buy something (if it's a web shop), you'll need some server-side language to modify data, interact with database or maybe just show different content to registered users. PHP will return HTML code as a result, but your webpage can be dynamic and you can interact with your visitors.
24th Nov 2018, 6:34 PM
dρlυѕρlυѕ
dρlυѕρlυѕ - avatar
+ 2
HTML is a markup language and it is used to build websites, although very basic ones. Advanced websites use css, and JavaScript to add color, shape and animation. PHP in the other hand is a programming language like many others, and it is usually used to save data from forms into a data base as well as getting data out of a data base, to then display that data as HTML.
24th Nov 2018, 6:26 PM
voidneo
+ 2
Php is php hypertext preprocessor. Notice hypertext and preprocessor ? PHP need html to work (well not really but for a website, html are really needed), why do we need php where we can built everything in html ? Consider you're making a simple blog, did you really want to re create the entire html page for a single post ? What about the homepage, the realeased blog list should be updated in every page so everyone can see a new blog post added. now think about if you want to change the html structure for the entire website. That'll waste so much time, effort, and some disk space. Instead in php you only need 1 page for the blog post, and 1 page for the home page, easier to update than rewrite the entire website. To add a new blog post, simply store them in database and let php handle on how to show them.
24th Nov 2018, 6:29 PM
Taste
Taste - avatar
+ 2
thank you so much for your answers guys!!! it’s very helpful for me, i really understand now!
24th Nov 2018, 11:40 PM
luzdeluna
luzdeluna - avatar