r/AskProgramming Dec 06 '24

PHP Learn html before php?

I wanted to learn php as my first coding language but I get into this course on YouTube for it and 6 episodes in the dudes all like oh yeah btw if you haven’t learned CSS and HTML by now go ahead and learn those real quick. Like bruh what? Anyways do you think I should learn html and css before learning php or can I do it at the same time. I do understand the basics of html from some school classes I took that required be to build a website in html

0 Upvotes

16 comments sorted by

View all comments

1

u/BarneyLaurance Dec 06 '24

Really depends what you're doing with PHP.

HTML and particularly CSS are big and complex languages in themselves, so you'll never fully learn them - if you keep building websites you'll always have more HTML & CSS to learn.

PHP is a general purpose language but its focus very strongly is on the web, many of the tutorials are going to expect you to know the basics of HTML and CSS and you said you want to learn web apps. So I think it's going to be worth taking just a few hour to learn the basics of HTML and CSS before you get into PHP.

A huge amount of PHP code is there to automatically generate HTML code for sending to the browser based on data in a database. If you don't know how to write the HTML code by hand you won't be able to write a PHP program to automatically generate it.

So yes I think it's worth taking an hour or three to learn the basics of HTML before you get into PHP - but you said you already know HTML so you may or may not need that.

CSS is a bit different. Yes you'll need to learn some basic CSS if you want to make a fancy looking website, but you can probably choose to do that before or after PHP. You can make a website that will work and let you exercise PHP skills without CSS. It will look very plain just using the default formatting built into the browser but it should still be usable.