PHP Tutorial | Complete Introduction To PHP
What is PHP?
PHP Tutorial – PHP (Hypertext Preprocessor) is a widely used, General-Purpose, Server-Side Programming and Scripting Language. It is developed in 1994 by a Canadian Programmer Rasmus Lerdorf. Latest and Stable version of PHP is 7.
It is used to develop websites, web applications, etc. Hypertext Preprocessor (PHP) is also used to create connection with database with the help of MySQL. PHP is embedded with HTML it means you can’t use PHP without HTML. Below you’ll also learn some PHP Tutorial.
If you want to run PHP, Laravel, Codeigniter code in you Computer then you need to install XAMPP Sever or any alternative of this software in you Computer without any Web-Server you can’t run PHP code on your Computer.
Install XAMPP :- https://www.apachefriends.org/index.html
Characteristics of PHP
PHP is Open-Source Programming or Scripting Language it means it is available for Free for all to Learn PHP. There is no need to buy any licence or anything.
This is also famous for its portability it can be run on any platforms like Mac OS, Windows, Linux, etc.
You can Encrypt your data in PHP by using its predefined built-in Functions.
The PHP Framework is used to Develop Web Applications. The advantages of PHP Framework is libraries and pre defined function that helps you in Coding/Programming and make your work easy and save time. Some of the famous PHP Framework is Laravel and CodeIgniter but there is also some more PHP Framework that are listed below :-
- Zend Framework
Make your 1st Hello World! Program in PHP. Code is given below.
<!DOCTYPE html> <html> <body> <h1>PHP Basics</h1> <?php echo "Hello World!"; ?> </body> </html>
PHP Comments is a line in PHP code that is not shown in output. Basically comments are used by Programmers to Understand the code. There is two types of comments 1st one is single line comment and 2nd one is multi line comment.
Single line comment begin with # or // and you can only write a single line of comment using this symbols.
Multi line comment begin with /* and ends with /* in between you can write multiple line comments.
Variables is uses to store information like integer, string, etc. In simple words you can say variables is like a bucket where you can store something. There is some rules for declaring a variable in PHP.
- Before writing a name of variable you need to write $ sign.
- Variable name can’t be start from integer.
- A variable name can only be start with a letter or underscore.
- Variable names are case sensitive. $VAR and $var both are different variables.
DataTypes defines which type of data stored in a variable like integer, string, etc.
PHP Integer :-
Integer DataType stores numeric value between -2,147,483,648 to 2,147,483,647 without decimal.
PHP String :-
Spring is a sequence of characters. When writing string in PHP you need to use single or double quotes.
PHP Float :-
Float DataType store numeric value with decimals.
PHP Boolean :-
Boolean is uses in conditional statements. Boolean only tells that statement is true or not.
PHP Array :-
Array can store different values in a single variable.
Operators are very important if you want to Learn PHP. Operators are used to perform variety of tasks like adding two numbers, comparison, etc. There is some types of operators are explained below :-
These Operators are used to do mathematical operations like addition, subtraction, multiplication, etc. Arithmetic Operators Sign with their usage are listed below :-
|+||Used For Addition|
|–||Used for Subtraction|
|*||Used for Multiplication|
|/||Used for Division|
|%||Used for Modules|
These Operators are used to do comparison between two values. Commonly used Comparison Operators signs with their usage are listed below :-
|Not Equal to|
|<=||Less than or Equal to|
|>=||Greater than or Equal to|
These Operators are used to combine two statements for comparison. Logical Operators signs with their usage are listed below :-
Get Some Best Top Rated Free Courses at anontricks.tech