PHP is a general-purpose scripting language especially suited to web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1994.
- Type some thing on the screen
To type on the screen u need to use the echo command
echo("Hello!");
or
echo "Hello!";
- Variables
Variables are containers where we can store pieces of data we want to work with in our programs.
You create a variable by putting $ sign in the beginning.
$characterName = "George";
$characterAge = 70;
Tutorial on Variables - youtu.be/-1iErfiYpBU
- Comments
In computer programming, a comment is a programmer-readable explanation or annotation in the source code of a computer program. They are added with the purpose of making the source code easier for humans to understand, and are generally ignored by compilers and interpreters.
#This is single line comment
/*
This is
a multiline
comment
*/
- If Statments
In computer science, conditional statements, conditional expressions and conditional constructs are features of a programming language, which perform different computations or actions depending on whether a programmer-specified boolean condition evaluates to true or false.
$ismale = true;
if ($ismale) {
echo("u are male");
} else {
echo("u are not male");
}
Tutorial on If Statements- youtu.be/KU8jKqn1-HQ
- Functions
This is a simple function to say hi.
sayHi is the function name, the name of the function could be anything.
function sayHi() {
echo "Hello";
}
Tutorial on Functions- youtu.be/lBPa92h2AqE