Website Design with PHP Introduction

PHP is a scripting language, which means it's not compiled by a compiler. Confused? You should be if you are new to development. Essentially, scripting languages are great for beginners because they are robust, yet take very little time to start writing code. I can't be for sure anymore, but PHP basically dominates the internet with the majority of websites using it as their language. Why? Because PHP is extremely simple to write and throw on a server to display a website. Honestly, you can have a website online with PHP within minutes of writing some code. It would be a terrible website, but you'd have a great amount of hosting providers willing to take your code and show it when a user navigates to you website (domain).

In my professional work, I deal mostly with more advanced languages like C# in dot net. Not an easy starting point for beginners as it requires considerable amount of time to learn the usual workflow and ideas of the language, but it's incredibly powerful and concise with what it can do. PHP can do all of those things, but its learning curve is much better suited to the better. Just know that once you become more advanced, there are better languages out there to work with. PHP provides great advantages for websites because it's easy to learn and well supported by most hosting providers. More advanced languages as mentioned require more dedicated and costly hosting providers. So, unless you are building an extremely complicated website, those languages probably are not the best choice for your website.

Before you dive into writing your first PHP website for your business or just for yourself, do yourself a favor and only use PHP 8 or higher. PHP has improved considerably over the years in terms of being more cohesive in what it provides though it still has a long way to go. My biggest complaints with PHP stems from function naming conventions and lack of initial object support, but I digress. PHP 8 brought a lot of extra features that are helpful for beginners that are fairly standard in other languages. It's not that PHP didn't have ways to do these things, but it just wasn't as intuitive as it is now. We will probably discuss some of these functions in later tutorials.

With all of those tangents aside, a dynamic website can easily be constructed with simply PHP, HTML, and CSS (maybe a bit of JavaScript). That's legitimately all you need in terms of languages to write a dynamic website for a business. By dynamic, I mean that the website isn't simply something you could write in word and just show to people. If you need a website to just show information from text files you've created, you could easily just make a website consisting only of HTML and CSS. However, anything more than that requires a server side language like PHP. It allows you to change the HTML based on logic, like a database or just various conditions/states of the page. A contact form shows the most obvious reason for a server side language. You can't create a website in HTML and CSS that would give your users the ability to contact you through a contact form with just those. You need to send a request to your hosting provider's server that can process the request and generate an email.

Hopefully, this introduction provides a decent overview of what PHP is and why it's a critical tool for small businesses and individuals to use for their website.