WEBVTT

00:00.530 --> 00:03.770
I will call you back again to end of the lecture in PHP.

00:03.770 --> 00:10.460
And in this video lecture we go ahead and learn how to write our very first PHP code.

00:17.300 --> 00:17.660
All right.

00:17.660 --> 00:19.490
So we're going to write our PHP code.

00:19.490 --> 00:21.530
And that is the very first thing we're going to do.

00:21.530 --> 00:26.480
Because in the previous lecture we are able to download and install atom on our systems.

00:26.480 --> 00:32.810
And like I told you, if you have any other editor, go ahead and follow up immediately.

00:32.810 --> 00:34.640
Every other thing is just the same.

00:34.670 --> 00:35.240
All right.

00:35.240 --> 00:36.980
So I actually got this atom.

00:37.010 --> 00:42.320
In case you don't have any editor with you, you can go ahead and join me step by step and we'll get

00:42.320 --> 00:43.040
to this point.

00:43.040 --> 00:44.540
So once you install atom.

00:44.570 --> 00:46.100
This is what we're going to have.

00:46.100 --> 00:50.240
And now you can see that everything here is just a welcome message.

00:50.240 --> 00:53.510
I will go ahead and close all these things.

00:53.900 --> 00:56.060
So of course everything right in here.

00:56.060 --> 01:01.080
What are we going to do now is first of all we're going to add a folder because it says we should add

01:01.080 --> 01:02.130
a folder right in here.

01:02.160 --> 01:05.160
Now let's go ahead and add a folder.

01:05.400 --> 01:07.980
Remember we have not created any folder yet.

01:08.010 --> 01:09.870
That means we have to create a folder.

01:09.870 --> 01:15.330
And I'm going to show you where your folder will be created, because that is where PHP will actually

01:15.360 --> 01:18.030
go to go and look for PHP files.

01:18.030 --> 01:24.810
So go ahead and hit on add folder and go over to PC and go over to Local Disk.

01:25.380 --> 01:28.530
Then move to users and they will click on this.

01:28.560 --> 01:33.120
Select the name of your computer and uh open up this.

01:33.150 --> 01:37.530
Then inside here you can be able to add a new folder right here.

01:37.560 --> 01:39.300
I'm going to stretch this open.

01:39.390 --> 01:43.380
And uh let's go ahead and add a new folder right in here.

01:43.440 --> 01:48.120
So I'm going to go over to new and I'm going to add new.

01:48.150 --> 01:52.140
Then the name of the folder I'm going to add I'm going to say w w w.

01:52.140 --> 01:55.110
Now you can add any name of your own choice.

01:55.290 --> 02:01.150
So I just created a folder called w that is the name of a project.

02:01.150 --> 02:03.670
So I'll go ahead and hit on select for that.

02:03.700 --> 02:09.310
So remember that you can do to change this name in case if you want you can go ahead and change this

02:09.310 --> 02:09.790
name.

02:09.790 --> 02:12.970
I just added WW w as my own favorite.

02:13.000 --> 02:18.220
Okay, so it's nothing more to do that now you have been able to create this.

02:18.250 --> 02:25.870
What you need to do is go ahead and right click and create a file right in here I'm going to create

02:25.870 --> 02:26.620
a new file.

02:26.620 --> 02:31.090
And I'm going to call that file name to be any name you want.

02:31.120 --> 02:34.570
Let me go ahead and say site dot PHP.

02:35.020 --> 02:35.560
All right.

02:35.560 --> 02:37.330
So this is site dot PHP.

02:37.480 --> 02:39.340
Go ahead and hit on enter.

02:39.340 --> 02:44.620
And I have sites dot PHP and go over to this folder.

02:44.620 --> 02:50.320
You can see I have the PHP file right in here called phi dot PHP.

02:51.550 --> 02:51.940
All right.

02:51.940 --> 02:53.320
So I have never to create a folder.

02:53.320 --> 02:55.090
And I've been able to create a file.

02:55.090 --> 03:01.460
And this PHP file I just created is exactly the same thing with HTML5.

03:01.550 --> 03:08.810
Remember that our HTML is Hypertext Markup Language and PHP is hypertext preprocessor language.

03:08.840 --> 03:09.260
All right.

03:09.290 --> 03:18.410
Now whatever you are going to do is ensure that you have little knowledge or full knowledge, little

03:18.410 --> 03:19.070
or full.

03:19.100 --> 03:24.620
But you would not going to learn PHP if you don't have knowledge of HTML at all.

03:24.710 --> 03:31.100
So if you don't have knowledge of HTML, our advice will check out our HTML courses on our site and

03:31.100 --> 03:36.920
kick off immediately so you can be able to get the fundamental knowledge of what HTML is all about.

03:36.920 --> 03:44.750
But if you have little knowledge or a pro in HTML, you go ahead and kick off immediately.

03:44.750 --> 03:48.590
So PHP is actually just the same thing.

03:48.590 --> 03:52.340
And we're going to use HTML files right in here.

03:52.370 --> 03:55.520
Now we have been able to create sites dot php.

03:55.550 --> 03:59.190
I'll go ahead and add a word means.

03:59.550 --> 04:02.880
What I'm saying is that I just created a HTML skeleton.

04:02.880 --> 04:06.390
That is where we're going to write our PHP code.

04:06.390 --> 04:13.680
So this HTML skeleton will help us to be able to write PHP code and execute our programs.

04:13.740 --> 04:17.070
Now you have this, uh, stub right in here.

04:17.100 --> 04:23.460
You're going to write your PHP code inside the body of this HTML skeleton.

04:23.910 --> 04:27.900
So whatever you're going to write in PHP is going to be right inside the body.

04:27.900 --> 04:33.390
And let's go ahead and write a simple PHP, uh, code.

04:33.390 --> 04:40.590
And then we execute that and see how that works, because that will enable us to be able to understand

04:40.590 --> 04:42.240
whatever we are doing.

04:42.240 --> 04:49.800
So to write a PHP code, you're going to write a tag, open up a tag and uh, name that to be PHP.

04:49.920 --> 04:54.060
And then you go ahead and close that tag as well.

04:54.070 --> 04:57.670
So go ahead and close that tag.

04:57.670 --> 05:04.240
And, uh, once your tag is closed, that means PHP will run inside here.

05:04.330 --> 05:08.860
So anything you write inside here is your PHP code.

05:09.310 --> 05:13.420
And a simple PHP code is going to write is going to be equal.

05:13.420 --> 05:17.530
Anytime you use the word equal, it means you want to voice out.

05:17.530 --> 05:20.170
That means PHP is about to voice out.

05:20.170 --> 05:25.600
Sunday is going to be able to read whatever it is written after this equal.

05:25.600 --> 05:29.440
So this guy had a right simple hello world.

05:29.440 --> 05:35.080
And once you write that, you close that with a semicolon at the end and you have written your very

05:35.080 --> 05:40.120
first PHP code, what means remains now is to execute this code.

05:40.150 --> 05:42.010
Now go ahead and save your file.

05:42.040 --> 05:45.160
Anytime you write, ensure that you save your file.

05:45.370 --> 05:51.790
Now if you go ahead and run this because this is not dot HTML, it's not going to run that way.

05:51.790 --> 05:54.730
You have to first of all create a server.

05:54.760 --> 06:01.600
Then open up your command prompt and open up a server.

06:01.630 --> 06:04.660
We're going to create a server, but it's going to help us to run this.

06:04.660 --> 06:10.960
And for you to create a server here, what we need to do is you're going to write PHP.

06:10.990 --> 06:12.190
Your command prompt.

06:12.190 --> 06:20.050
And then you're going to put this in the use opaque keys S then call lookup.

06:22.630 --> 06:24.880
Then lookup hosts.

06:24.910 --> 06:31.120
Now once you've added a lookup rules have to add a colon for Tarzan.

06:31.150 --> 06:33.430
Then go ahead and hit enter.

06:33.820 --> 06:35.830
And hit enter.

06:35.830 --> 06:47.020
It will say what is the September 11th PHP 8.3. 11 development server lookup was started.

06:47.230 --> 06:51.220
Now you can see that we have our server right in here.

06:51.220 --> 06:53.000
We have started this.

06:53.060 --> 06:59.420
The development server has actually started and is listening at this point.

06:59.930 --> 07:02.090
HTML blah blah blah.

07:02.120 --> 07:11.810
Lukaku is 4000 copies, so I just copied that and uh, I was able to copy this.

07:12.560 --> 07:17.360
Now I want to start the server again because I have this year I don't want to close this.

07:17.360 --> 07:20.270
Anytime you're working on this, don't ever close this command prompt.

07:20.270 --> 07:21.890
So I'm going to repeat this again.

07:22.130 --> 07:22.580
PHP.

07:24.410 --> 07:31.130
S local host colon 4000.

07:31.130 --> 07:33.380
So I have to start it again.

07:33.380 --> 07:39.950
So at the point of running your PHP code, ensure that your command prompt is always open.

07:39.950 --> 07:42.800
You can actually go ahead and minimize this right.

07:42.830 --> 07:48.020
Then go back to your browser and go ahead and pass all that which you just copy it.

07:48.020 --> 07:50.780
And once I paste that I'll go ahead and hit enter.

07:50.790 --> 07:52.290
And now I hit enter.

07:52.290 --> 07:54.090
I see not found.

07:54.120 --> 07:57.810
The request test source was not found on this server.

07:57.810 --> 08:02.100
So the server we just created is actually having nothing.

08:02.100 --> 08:04.530
And remember that we created this.

08:04.530 --> 08:06.480
So we created a folder right in here.

08:06.510 --> 08:10.200
So that folder is under the user our users.

08:10.200 --> 08:13.470
And the default name is W-w-w.

08:13.500 --> 08:19.830
Now what I want to do is because that is your PHP, we always go, you go ahead and put a backward slash

08:19.830 --> 08:22.950
and then go ahead and say w w w.

08:23.400 --> 08:25.920
So this actually open up some things I've done before.

08:25.920 --> 08:31.980
And backward slash site dot p h p.

08:32.010 --> 08:33.540
So go ahead and remove all this.

08:33.540 --> 08:38.760
And if I go ahead and click on this right now you can see I have Hello world.

08:38.820 --> 08:42.570
All right you guys when I was typing I was actually getting what I've done previously.

08:42.570 --> 08:46.020
And that is actually not a problem.

08:46.020 --> 08:50.860
And we go ahead and uh, media ran with these.

08:50.860 --> 08:56.110
So we've been able to create our server, and our server is currently running around at the moment.

08:56.110 --> 09:02.170
And then we have this folder we created and the file name is uh site dot PHP.

09:02.200 --> 09:03.400
I hope that is cool.

09:03.910 --> 09:06.400
So this is the code we actually used.

09:06.430 --> 09:12.940
We are able to echo out Hello World and we created a folder, a server using our command prompt.

09:12.940 --> 09:15.250
And that server is actually running.

09:15.250 --> 09:17.320
And we are able to get this.

09:17.320 --> 09:19.600
So that is really cool and very interesting.

09:19.600 --> 09:21.250
So I hope that is cool.

09:21.280 --> 09:27.790
Put on this practice with this and show you you run your very first PHP code, and then we move deep

09:27.790 --> 09:30.700
into the course and enjoy the PHP.

09:30.730 --> 09:32.500
We just started right now.

09:32.500 --> 09:38.230
So there are lots of things to learn in this course and just get started and practice whatever we do.

09:38.230 --> 09:43.210
And if you have any question, use the question and answer section and I'm going to get back to you

09:43.210 --> 09:44.230
as soon as possible.

09:44.260 --> 09:45.190
Thank you so much.

09:45.190 --> 09:48.340
And I'm going to see you in the next video lecture.
