WEBVTT

00:00.380 --> 00:00.950
Okay, guys.

00:00.950 --> 00:05.150
So something important that I really would like to stress.

00:05.180 --> 00:10.400
We're going to be running PHP programs through command line terminal.

00:10.430 --> 00:15.170
However you call it on Mac OS, that's just a terminal app.

00:15.200 --> 00:18.650
You might also use a third party terminal applications.

00:18.650 --> 00:24.680
And on the windows this is command prompt or preferably PowerShell.

00:24.680 --> 00:28.850
It's identical on all the systems, even on Linux.

00:28.850 --> 00:35.240
What's important is that you have PHP available through command line.

00:35.270 --> 00:42.170
You need to run PHP hyphen v, and this should give you a PHP version.

00:42.170 --> 00:46.550
And we're going to run the PHP code this way.

00:46.550 --> 00:54.650
Even if we already have a web project, we would be using a built in PHP server to start the server,

00:54.650 --> 00:57.740
so it's available in the web browser.

00:57.740 --> 01:07.460
But before we do that, we're going to be using PHP through command line to run PHP code like this one.

01:07.460 --> 01:16.340
So the way it works is you type PHP and you follow that by the location of the PHP file you'd like to

01:16.340 --> 01:16.970
run.

01:17.000 --> 01:27.200
If I run this one, this is a roll a dice example, which you can roll until you hit jackpot or until

01:27.200 --> 01:28.910
you just tell it to stop.

01:28.940 --> 01:35.570
That's a one way to run it through your terminal application, whatever is the name of this terminal

01:35.600 --> 01:36.170
app.

01:36.410 --> 01:43.550
Another way which I often do is within the built in Visual Studio Code terminal.

01:43.550 --> 01:48.020
There is absolutely no difference which way you use.

01:48.020 --> 01:53.240
So in here in the view menu you've got this terminal option.

01:54.380 --> 01:56.390
This will open a terminal.

01:56.390 --> 01:58.910
In your case it might be at the bottom.

01:58.910 --> 02:02.150
I just have VSCode configured for this project.

02:02.150 --> 02:03.830
So it is on the right.

02:04.910 --> 02:08.480
And in here you do it exactly the same way.

02:08.480 --> 02:15.290
It's important that you need to be in the directory of the project where you have all those files,

02:15.290 --> 02:19.640
and then you can run the programs the same way.

02:19.640 --> 02:22.580
There is absolutely no difference.

02:24.410 --> 02:32.000
Now, finally, it might be just useful to learn the shortcut for opening the terminal inside VSCode

02:32.030 --> 02:33.620
on my system.

02:33.620 --> 02:36.140
This is just control.

02:36.170 --> 02:36.860
Tilde.

02:36.890 --> 02:44.570
I think it is similar on windows, but you can check it out by just opening it from the view menu.

02:44.600 --> 02:46.730
You're gonna see it right here.

02:46.730 --> 02:54.080
So as a summary, doesn't matter if you use the built in terminal in VSCode, as I will be doing most

02:54.080 --> 03:02.600
of the time, or a separate app like PowerShell, Command Prompt terminal or warp, whatever terminal

03:02.600 --> 03:04.010
app you prefer.

03:04.070 --> 03:08.150
It's just the way we're gonna be running PHP programs.
