Php is a scripting language which scripts are executed on the servers. It is widely used and free to download and use because it is open source programming language. What you should already know about php while starting programming in it:
Because it can be run on any platform like windows, Linux, Unix, Mac OS, etc. It is compatible with almost all the servers used today like Apache, IIS, etc. Php is easy to learn and after learning you can run the code efficiently on the server side, It also support wide range of database.
it is powerful to be at core to the biggest blogging system on the web, Run to the largest social network like facebook because deep enough, easy to learn for the beginners first server side language.
Php Filecan contain php code, html, css for styling sheets and javascipts, code is executed on the servers side and result are show on the client side in html format only having a extension .php.
It Can generate dynamic pages and perform many operations like create, open delete, append update close on the server files and delete , update and modify in your database, can encrypt data and collect form data. Basically it is used to control user-access.
Variables are like containers to storing information. In php variable strt with the sign dollar like $ and followed by the name of the variable. It can be a short name like a character(like a and b) or the descriptive name(like employee, employee_salary and so on). There are some rules to define a variable in php variables names are case-sensitive($employee and $EMPLOYEE are considered as two different variables), nam can only contain alphanumeric character and underscores, cannot start with a number.
It automatically convert variable to correct data type. Php variables scope is of three types local, global and static .a variable declared outside the function have global scope and can be accessed outside the function only and in local scope variable declared inside the function scope is only in that function only in which it declared. Static keywords. Usually, when function execution is completed then all the variables are deleted but sometimes we a need a local variable not to be deleted for that we use static keyword.Functions
The real power of php comes from function there is 1000 Built in function. Besides the Built-in functions user create its own functions that is called User-defined function. Function is a block of statements that used repeatedly in a program, a function will never load immediately when a page loads it executes to call a function.
Rules : function start with the name and underscore, give the name of the function that it does, Functions are not case-sensitive.
Function arguments: Function arguments are the information passed to function through arguments, an argument is just like a variable.
When user wants to perform different action for different decisions then conditionals statements are used. It is of following types:
Sometimes user need to run same code over and over again except adding several same line of code to it we use loops to perform the same action or task. In php there are following loop statements:
Array is use to store a multiple values in one single variable, It is a special variable which can hold multiple value at the same time in other words we can say it is a ordered map I which values associates to keys.Function syntax to create an array: array();
In PHP there are three types of array:
Hello World program in PHP*/ <?php echo 'Hello World'; ?>