I was nervous about being introduced to the PHP basics after the amount of time it took me to finish the gallery assignment. Another web development ingredient thrown into the mix sounded to me like a disaster in the making. This week I tried to make more sense of the purpose of PHP and I decided to turn to metaphors. The metaphor is, “the website is the restaurant and PHP is the cook who serves up a particular dinner order made from a set of ingredients. HTML is like the food on your plate when it arrives. CSS is like the restaurant decor- the color of the plates, the placement of the lights and table clothes, the quality of the silverware and the outfit of your waiter.” I understand that PHP is a server-scripting language, but wouldn’t that mean that every website requires PHP? With this metaphor in mind for the creation of websites, you can’t have a restaurant without a cook making the food. After learning a little bit about PHP in last week’s class, I feel like it would be helpful for me to reinforce the purpose of PHP with a website and then examine the impact PHP has on that website. This will definitely be one of my questions in tomorrow’s class so stay tuned!
Another thought about PHP is that it seems awfully similar to JavaScript in some aspects. For example, the “$” and for loops. I know there are some web developers that like to do HTML, CSS, and JavaScript on one file, but how do you avoid getting confused between PHP and JavaScript especially as a beginner? Is PHP basically a version of JavaScript, but for back-end purposes? Are there websites that are robust without PHP or does PHP help make the world go round in the web development world?
Is it ever helpful for beginners to understand back-end before front-end?
I found this chart on a website defining the difference between JavaScript and PHP and I thought I’d share to help other students:
Any dynamic website requires some kind of scripting language (PHP, Python, Ruby, etc) to interact with a database for retrieving or saving content. A static website is only front-end code (e.g. HTML, CSS, JavaScript) with no scripting language and no database.