Want to learn PHP from scratch? You’re in the right place!
This PHP tutorial for beginners full course is designed for absolute beginners who want to step into PHP programming with confidence. In just 30 minutes, you’ll understand the core concepts of PHP and how it’s used in real-world web development for beginners.
Whether you’re planning to become a web developer, build dynamic websites, or add backend skills to your profile, this PHP tutorial for beginners full course will guide you step by step in a simple and practical way.
👨💻 What you’ll learn in this video:
✔ Basics of PHP programming
✔ How PHP works with HTML
✔ Essential PHP syntax for beginners
✔ Real-world examples for web development beginners
✔ How to start your journey as a PHP developer
This video is perfect if you’re new to coding and looking for a clear, beginner-friendly PHP tutorial that actually makes sense.
👉 Watch till the end to build a strong foundation in PHP and kick-start your web development career!
🔖 Suggested Hashtags
Show More Show Less View Video Transcript
0:00
Okay, today I'm going to start PHP from the scratch. So first
0:07
uh before we are diving into the lesson, first you must know uh how to install
0:14
the PHP. PHP is nothing but a server side programming language. So here when
0:22
you when you uh run the PHP we need a server. Okay.
0:33
Okay. The server we will you have any idea about that
0:38
zam? It may be the zam or ma'am or ecphp
0:47
or uh zam ma'am ecphp and
0:54
vamp. Okay. So if you go to that respective website you just copy this
1:00
and put into here click on it it take you to that uh particular website. This
1:05
is Z. Okay. When you work with the ma'am.
1:11
Okay. When you work with the ma'am. Okay. What ma'am?
1:20
Okay. This also you will be able to work this
1:27
map. Okay. This is more popular in India. uh many companies are connected
1:33
uh using the map. Okay. So another one is a ECP.
1:41
Okay. This is also the favor while you work with the PH EP.
1:49
Okay. So after that another one is a map vamp
1:55
this also the popular. Okay. So this vamp server this also okay
2:02
you can select one of out of this okay so now today I'm going to first I'm
2:08
going to teach how to download the zamp okay zam so go to that site zamp
2:17
download click download now you have to select the corresponding
2:24
operating system so if you have a Mac OS Yes, you can go go along with the Mac
2:31
one. If you have a Linux, you go along with the Linux. Okay, you have to select
2:36
the corresponding operating system. What is the operation you have? So, my current I have a currently operating
2:43
system which is a ZAM. So, I'm go along with the ZAM. So,
2:50
uh so I'm going to go to uh download the version. Uh this is the current version.
2:56
This is a learn version 8 point. This is the current version.
3:05
This is the current version. Okay. So now I'm going to go to download.
3:12
Let's download. Click it. Download.
3:22
Okay. You have to wait until downloaded process complete. Okay. Go to inside the zam. Go to H
3:31
docs. Here you have create your applications. Okay. So now I'm going to go to create
3:38
the application. Uh I'm going to go to create the application. Okay. File new.
3:44
So don't be no need to create here. You have to put it here as uh one folder.
3:51
This name is PHP projects. Okay.
3:58
Okay. So, go inside the PHP project folder. Type cmd command
4:05
and code space dot to open the command prompt window.
4:12
Okay. Now here
4:17
I'm going to create the project name just index dot PHP.
4:24
Okay. When you create the index dot PHP file you can see the icon should be
4:29
changed as a PHP logo that's why that VS code editor is more
4:36
popular editor in the world. whatever the language you are working on it the
4:42
uh that icon also change the uh change according to the language.
4:49
Okay. So now when you write the PHP you have to start
4:55
with the code here.
5:01
Write like this. Okay. PHP you can write like this. Starting tag. Closing tag
5:07
must be like this. This is the starting tag.
5:13
This is the closing tag. Okay. When you print any application,
5:20
you have to in Java you write system.out.print l in PHP write echo.
5:28
You can write hello world
5:34
in programming terms. When you write anything else as a name or any text
5:41
words, you can write as a within the double quotation marks. Okay,
5:47
that is the theory of the program. Okay, now let's save all.
5:53
Let's save all. Now what I'm going to do is I'm going to run that application. So
5:58
run it. Go the project is running here. Okay. First you must it is running
6:05
successfully. Now you write it local
6:11
port 80.
6:18
Wait, wait.
6:35
What to do is so we have created the project which name
6:41
is index.php. We return we return successfully. Now when you are run on the project how to run the project you
6:48
have to go to the your browser type local host local host mean your current
6:54
machine your current machine okay that is a local host okay it's meaning of
6:59
local host uh you have to mention local host so
7:04
when you me mention local host it it automatically indicate the path of the
7:10
zam server ht dots it point of the path of the inside the HD doc uh inside the
7:17
HD doc you are working on which folder there are various folders inside the t
7:22
do so I'm working on the php projects folder you this name just copy this and
7:29
provide the URL here localiz PHP project now you'll be able to uh see
7:35
the hello world okay that's the things now uh now I'm going to teach another
7:44
things how to add two numbers. Okay. Uh before add two numbers we have to
7:49
declare two numbers. So okay when you work with the numbers you
7:56
remove the double quotation mark. Okay. Simply you have to put three. What happened the output? Same all. Going
8:04
back to the applications three has been printed. Okay. Three has
8:11
been printed. Now 3 + 3 2 3 answer will
8:18
be
8:23
six. Okay. This we can work with the numbers.
8:37
Now I'm I'm moving to the variables. Variables are
8:44
nothing but a okay memory location. They
8:50
are store the value in the memory. Okay. So
8:55
imagine if this is this is called as X which is a variable name. This is a 10
9:05
mean value. In PHP we no need to specify
9:10
any data types. There are no data types at all in PHP. Okay. Okay. In PHP the
9:18
language if you take about the Java or C or other program language data type
9:25
must. Okay. So here in PHP we don't have any data type to use. Okay. So when you
9:31
implement the variable name you can use it the dollar sign before
9:37
that. Okay then only it works. Okay. So just copy this and paste on it.
9:46
This is the variable name. Okay. Variable name. Okay. This is the value
9:53
variable name. And well okay understand. Now I'm going to print
10:00
echo. What x? What is the answer?
10:10
10 will be the answer. Okay.
10:16
10 will be the answer. Okay. Now I'm going to calculate two
10:22
numbers. Okay. So first what I'm going to do is I'm going to declare two
10:27
numbers. So how to do declare two numbers x= 10 y = 5.
10:35
So I want to get the total. So echo x +
10:40
y. Okay. Control s to save. Bring back to the application.
10:53
Total has been calculated as 15.
11:00
Total has been calculated as 15.
11:06
Okay. Again uh extend uh y5 total as
11:14
calculated as has been 50. Okay. So if you want to look at the output in
11:20
different ways. So I'm going to go to this one. I'm using the uh operators
11:26
arithmetic logic arithmetic operators. When you look at the arithmetic operator
11:31
plus is a minus can use the minus. So here in between that two going to put it as a break. So
11:40
can write it here the double quotation mark
11:45
break. Okay. So let's look at the output.
11:57
Five has been. Okay. After that
12:03
again I'm going to do the
12:10
multiplication. Let's look at the output. What what would be the output will be? Okay.
12:24
What would be the output will be? Okay. Multiplication
12:31
10 into 5 50 will be the answer. Division 10 /
12:37
5 2 will be the answer. Okay. Okay. Okay.
12:44
That's a uh formula of that is a formula.
12:51
Okay, that's a simple way to do the programming. Understand? I hope you have understand this one
12:57
clearly. Okay. Right. Now what I'm going to do is we have we have done the work
13:03
successfully so far. Uh
13:13
do you want to practice?
13:18
Okay. Now I'm going to do the commands. Okay. How to work with the commands?
13:25
Comments which which we use to describe the program
13:30
which you are using to describe the programming. This is a single line command. Okay, this when you are writing
13:36
something else when you writing the coding uh something else imagine you you
13:43
are going to add two numbers so this code for adding two numbers so that is a describe name okay so when you are uh
13:53
once you done the programming uh imagine two or 3 months pass you
13:59
don't know what you write you write but why you write you don't know so if you
14:04
are uh write the code along with the command whenever you are go going
14:10
through the go through the code you are something your colleagues or your when
14:15
you work with the company friends so they must understand what you are returning okay by the comment comment
14:22
are very useful for describing the program okay so so uh now I'm going to implement the command so single line
14:29
command mean you can write like this single line
14:35
Okay, if it's a double uh multi-line command, you have to implement light like this.
14:44
Okay, there a multi-line command inside here you can destroy.
14:50
Okay, this is the purpose of command. Okay. Okay, this is purpose of command.
14:58
Now I'm going to do the simple exercises.
15:03
Okay. So I'm going to write uh I'm going to write a comment. So uh
15:11
multi-line command command because this is a one project. I'm going to do the project. So what you going to do is I'm
15:18
going to write a multipline uh multi-line command. So what is the project is input
15:25
student marks
15:33
of three subjects.
15:42
Calculate and display the
15:51
total as
15:57
average
16:02
and grade. Okay.
16:12
When you calculate the trade
16:18
must follow the
16:24
following
16:31
conditions.
16:38
So if the average
16:45
greater than
16:55
greater than 50 you awarded as
17:04
pass otherwise is
17:12
five. Okay, this is simple question. Based on the question, you can
17:19
write the program. So, first you can read twice
17:26
input student marks of three subjects. So, I'm going to
17:32
get three three subjects. So first subject max
17:39
okay 70 take example of 70 so whatever
17:46
second subject science
17:51
60 third subject English
17:59
60 okay so we declare the three subjects Okay. Is there anything any problem? No.
18:08
Now let's calculate them. So when you calculate
18:13
them, we can write we can implement the new variable t equal max
18:21
plus science plus English.
18:31
Okay. So these three values are assigned to this particular variables. So we have
18:38
to assign those here of this these three things are added and assigned to the total variable. After that uh when you
18:46
calculate and display the total into the total variable okay after that what you're going to is I'm going to do that
18:55
after get the total again we have to calculate the average as well. So how to
19:00
calcate the average? Simple. We can implement the variable average. We create the variable average. Total
19:08
divided into number of subject. There are three subjects available. So we have
19:14
divide by three. If if you have four subject, we have divide by four. More
19:20
than that, you have to uh divide the total
19:25
number of subjects. Okay. How many subjects are available? you have divide by the number of subjects here in this
19:31
example we have a three subjects so we have divide by three okay you have
19:36
divide by according to the subject you have okay right now done
19:43
now what I'm going to do is we have done we have done the total as well as average now I want to calculate the
19:49
grading system so I'm going to write if average
19:56
greater than 50. This is our condition. The average is greater than 50 awarded
20:02
as false otherwise fine. So if the average is greater than 50
20:09
here uh here uh we have write we can
20:15
declaring the variable u
20:21
great pass
20:31
otherwise file.
20:40
Okay. If the average is greater than 50, grade is pass otherwise fail. Okay. So
20:48
if and else this is this is the conditions. Okay. So if if this condition is true,
20:56
execute this block of code. If the condition is fails, go to the else part and execute this block of the code.
21:03
Okay. Okay. That's how we have worked. Now we save and execute the program.
21:10
Nothing would be printed. So we have to print it. So print. So how to write the
21:16
print? You can write echo.
21:21
Echo you can write first one within the double quotation mark. can
21:27
write this is called as a concatenate operator. Okay. Your total
21:38
is dot
21:43
what total distract. What is the meaning of concatenated
21:49
operators mean? You can along with the variable
21:54
along with the text. Okay. you can uh total you can get along with the text
22:02
totals. Okay. So after that I want to get the average as well. Average as well. So this copy and paste it over
22:08
here. In between total and average we need a
22:13
uh gap. It's called as a break. So BR.
22:22
Okay. So just copy and paste it over here.
22:28
Average is this average
22:35
or this break. After that copy this and paste it over
22:40
here below
22:46
the grade it's called as grade this grade.
22:54
Okay. So your total is averageages grades. Okay. If the
23:04
uh average is greater than 50 data as pass will be passed otherwise f okay
23:12
let's save all and bring back to the application check what would be the output will be here
23:21
that's it okay in between here we need a space without a base is not a good
23:31
is good.
23:36
Okay. Okay. So, if you want to show them
23:43
uh
23:49
Okay. So, you can show them this one.
23:57
B break bought
24:18
B. Okay. So it can uh uh in inside the PHP
24:26
you will be able to pass the HTML tag as well use along with the dot mark. Okay.
24:35
Otherwise you can't write. Okay. So this all the tags you can replace it above as
24:40
well.
25:02
Okay, it's a good example. Okay, now I'm going to teach the uh
25:11
variable types. We can uh see the types. So that's all things I'm trying to
25:21
copy this put into one notepad. Okay. Now what you're going to do is I'm
25:28
going to remove this. Now we have a variable a=
25:38
five. It's known as integer. B equal
25:48
uh smit
25:53
which known as text. Okay. C=
26:00
12 + 5 it's known as float. Okay. Pointing values. So now we can identify
26:07
the values. So we have to use the type as W
26:12
dump. Okay. V dump. We can write this
26:18
variable. Putting this variable. Okay. So let's
26:24
execute it. So file
26:30
int five. It's also based on int.
26:35
Okay. So here I'm going to go to copy this
26:40
just over here. B C
26:57
Let's execute and check it.
27:02
I can see the output as
27:08
the code.
27:23
Now here uh echo we need a uh space in between them.
27:31
break.
27:38
Now let's see the output. This output we getting.
27:47
Okay, this output we it has been generated. What is the
27:55
what is the exactly? What is the value? Okay, that that's how we can get
28:02
the values.
28:16
Okay, understand.
28:30
Okay. Now, now another important thing is the
28:37
casting.
28:43
Okay. So what is the meaning of casting is
28:50
these people are integers. These people are string category. These people are
28:57
based on the float category. So I need to this people converted to integer
29:05
type. Okay. So integer type something like that. Okay. So what we are going to do
29:11
is we have to do like this. we have to do the casting part. The
29:16
casting uh is little bit complicated. Okay, that's that's the thing. If it is
29:22
a Java also, we have do it that one. So the she the in the PHP it is very rare
29:28
to do the things. Okay, in PHP. So I want to cast
29:34
this variable into integer string. How to cast this is
29:41
this is a integer variable. I need to cast as a string. So how to cast it? So
29:49
first you have to declare in the variable type
29:54
A. Okay. So after that equal string
30:06
just cast it. After that you can write this a over here.
30:15
Okay, you can over here. Now let's check out the A
30:32
string. Okay, it's meaning of cast. Okay,
30:38
this is meaning of a cost. So what is the purpose we are using loop
30:45
is? So imagine you want to print 1 to 10.
30:53
Okay. So how how do how do you print echo 1, echo 2, echo 3? That is not a
31:00
professional way to implement. Okay. Uh so you even you can write 1 to 10 it is
31:07
possible imagine you have to write someone tell you to print 1 to 1,000 it
31:14
is possible very difficult to write so that kind of a that kind of purpose we
31:20
have to implement the loops so loop uh loops
31:25
we have we have divide by four first one is a for loop while loop uh do Y after
31:33
that 4 in. Okay. 4 in. Okay. So now the first loop we look at the for loop. For
31:41
loop it divided by three things. First one is a initial value. Second one is a
31:49
condition. Third one is a decre increment or decrement. Okay. Initial value mean value we are going to start.
31:56
It starting zero. Okay. Start initial value must be zero.
32:02
You can make it one or two whatever the starting point where your value going to start it's starting from the zero
32:08
position. After that second you have to consider about the condition. Okay. The
32:16
condition is uh work until which value
32:23
10. So there's a condition. Okay. It is work once the condition is f
32:31
only true only it works. Okay. After that increment first time it's go and
32:37
check uh zero coming and print zero. Second time it's uh it will be here it
32:44
will be check whether the 10 is greater than
32:50
one. It works. It is uh it is keep on printing. We have once the condition is
32:58
same. Okay. So let's execute and check it. So you you having any doubts you
33:04
will be okay. It is working until 10. Why
33:09
greater than equal 10 mean 10 also it's printing. If it is get rid of the
33:16
equal sign only it print until 9. Okay.
33:21
So uh first time zero is printed. Okay, first time second time it's coming
33:28
here uh zero is printed. Second time it's coming here. What's the condition? Uh what here? Increment by one. So one
33:38
less than 10 condition is true. After that again increment two again coming
33:44
here and check two is greater than less than 10. 2 is less than 10
33:51
condition must be true. After the again check three less than 10 or not
33:56
condition is true. It keep on printing until the value uh greater than 10 it
34:02
will be condition is false. It is uh print of the values and exit the loop.
34:10
Okay. When you write the y loop it's not for loop you are getting done by one
34:17
line. Okay. So uh when you implement the while loop so how to write it first you
34:22
have to first you have to start the initial value the first line value
34:27
starting from one this one put into this variable I after that second line we
34:33
have to write as a condition. Okay. So for loop we have to use the keyword for. When you are writing the
34:40
while loop you have write a keyword while. Here we have to implement the condition
34:46
I less than or equal to 10. Okay. After that we have to print the
34:54
value. After that we have to increment. Okay. This is the formula. We have the
35:00
same output but you have to you use in the different way.
35:06
Okay, you can go the same one. First you have to look at the condition
35:11
first. First first time it's print one. Okay, so this one I'm starting from one.
35:16
If you want to start with the zero, you have to put the initial value zero.
35:21
It's zero. Okay, it's less than equal. Okay, if it
35:27
is remove it, what happen? It print it has been print until 9.
35:35
Okay. So it's the initial value. This is a condition. Here we have we can print the value. After that we can put a
35:42
break. So each and every incremented we have to go to the next line. Okay.
35:48
Otherwise the same line it has been printed. Rather than print as the same line we have to go to the next line. We
35:55
have to put it to the break tag. Okay. It's refer as a next line. Okay.
36:01
of trial. This exam

