From the course: PHP for Non-Programmers

Your first line of code - PHP Tutorial

From the course: PHP for Non-Programmers

Your first line of code

- [Instructor] We're looking for quick wins and grasping concepts, so let's jump right in and write your first line of code. First, we'll visit replit.com. That's R E P L I T .com, and we'll sign up for an account. There are a few options here from a native replit account to connecting one of several other accounts. I've connected my GitHub account. Once you are logged in, look for the create button. For me, it's on the left and it might be hidden by a hamburger menu. Once you do that, a menu will pop up and it will allow you to create a template. There are two or three different ways to create PHP but we're going to be working with the PHP web server. So we'll select that. You can give it a name, I'll call this hello world, and then we can click create repl. Once your code area loads, you'll see three columns. On the left, you have files. We can hide that. We won't be using that here. You have your code editor, and then you have the console, which will also become the place where your code is executed. You also have some code in your editor already. You can go ahead and delete that. Now, with a blank slate, let's write our first PHP code. Type the less than sign question, mark, and then PHP. Every PHP code needs to start with this. It's called the opening PHP tag. Then we'll press tab and we'll type on the next line, echo, single quote, hello world, exclamation point. Outside of the second single quote, the closing quote, we will add a semicolon. More or less, every line of PHP needs to end with a semicolon. Once you have that, you can click run. The console will do its thing and then a window will show up with the text hello world in it. Congratulations! You've just written your first line of PHP code. Now, let's learn what it all means.

Contents