PHP- Everything You want to know about PHP
Scripting languages, the base of programming. In programming, programmers use scripting languages to create their programs. Scripting languages have a unique way and style. They are not friendly to ordinary people. A deep study wants to make it understand. The programmers must pay the attention to study those scripting languages before getting to programming. HTML, CSS, JavaScript are examples of scripting languages and the basic knowledge about the above scripting languages will help you to make better your PHP study.
PHP- Hypertext preprocessor is an open-source scripting language, which has many users over the world. The scripts are active on the server. You can free download PHP for use.
Evidence to prove the value of PHP
- PHP has the power to run the word press. Word press is the biggest blogging system on the web.
- PHP has the power to run Facebook, the enormous social network
When touching with PHP, it is important to know about PHP files.
- PHP file is consists with text, HTML, CSS, JavaScript and PHP code.
- PHP codes are active on the server, and the outcome is reappeared as plain HTML.
- .php is the extension of a PHP file.
And also,
- PHP provokes productive page content.
- PHP creates files, opens files, reads files, writes files, deletes files and c, and loses files on the server.
- PHP compiles form data.
- PHP send cookies, receive cookies
- PHP helps to rise your database by adding data, deleting data, and modifying data.
- PHP manages user access.
- PHP conceal data.
What you can output with PHP?
HTML, Images, PDF files, flash movies, XHTML and XML text and etc.
Importance of PHP
- PHP runs on assorted platforms like Windows, Linux, UNIX, Mac OS X, etc.
- PHP is congenial with servers like Apache, IIS.
- PHP supports a broad range of databases.
PHP is a free download source. You can try it from www.php.net, the official resource. PHP is uncomplicated to enroll and runs precisely on the server-side.
How does PHP 7 highlight
- Php 7 is quicker than php5.6
- Php 7 has revised fault handling.
- Php 7 helps harsh typer declarations for function arguments
- Php 7 supports new operators like spaceship operator <=>
So, ante starting PHP, a web host with PHP and MySQL support must be available with you.
But, no worries if your server already supports PHP. What you only have to do is set up some .php files and set them in the web directory. Then the server will naturally explicate them for you.
Php is free a free download source and most web hosts support PHP. So, you don’t have to be tired to accumulate anything or install any added tools.
How to composition PHP on your pc.
If your server already supports PHP, you do not want to do anything. But, if it not support, follow the instructions.
- First, install a web server,
- then install PHP,
- After installing a database. ( ex. MySQL)
You can get the PHP installation procedure from the official PHP website,
PHP syntax
A php script can be fixed in any place in the document. The starter of a php script is <? php and edge is?>
Example <? php
//PHP code
?>
- HTML tags and some PHP scripting codes commonly consist of in a PHP file.
- Php statements end with a semicolon ( ; )
PHP comments
A comment in PHP code is a line that is not accomplished as a factor of the program. It let someone study the code. Comments are used to give a sense to the readers and also use to prompt yourself of what you did. As they remind you of what you were thinking when you wrote the code. Php supports certain ways of commenting. There is the syntax for individual line comments, and also for numerous line comments. Comments use to leave out factors of the code.
PHP variables
Variables are containers for accumulating information.
Declaring/ creating php variables
In PHP, a variable starts with the $ sign, pursued by the name of the variable.
When you nominate a text value to a variable, put quotes around the value. Clashing to other programming languages, PHP has no command for declaring a variable. It is created the moment you first nominate a value to it.
PHP variables
A short name like (a and b) or a more descriptive name (brand name, price) can be available in a variable.
PHP variable rules
- A variable starts with the $ sign, followed by the name of the variable.
- A variable name must start with a letter or the underscore character
- A variable name cannot start with a number
- A variable name can only consist of alphanumeric characters and underscores (A-Z, 0-9)
- Variable names are case sensitive ($age and $AGE are two different variables)
Output variables
- The PHP echo announcement is very useful to output data to the screen.
PHP variable scope
The scope of a variable is a factor of the script where the variables can be referenced/ used. Three different variables scopes are available in PHP.
They are,
- Local
- Global
- Static
A variable declared outside a function has a global scope and can only be penetrated outside a function.
A variable declared within a function has a local scope and can only be penetrated within that function.
Characteristics of PHP
PHP is
- simple
- efficient
- secure
- flexible
- familiar
PHP data types
- String -progression of characters
- integer-a non-chemical number among -2,147,483,648 and 2,147,483,647
- float-a number with a chemical point or a number in an aggressive form
- Boolean- perform 2 possible states. They are TRUE or FALSE. Regularly used in conditional testing.
- Object-Object classes and objects are the two main facets of object-oriented programming. A class is a template for objects, and an object is an item of a class.
- Null-special data type which can have only one value
- Resource-The resource is not a definite data type.it is the storing of a reference to functions and resources external to PHP.
- Array-stores multiple values in one single variable