PHP






PHP means Hyper text Pre-processor.
Open source scripting language.
Executed on server.

Hyper text:
Link that links to other information.
Helps user for quickly finding the relevant information.

Pre-Processor:
Produces a output and that output is used as input for another program.

Downloading and installing PHP:

Variable:
Starts with sign of $.
No need of declaring data type like other language.
Case sensitive.
Example: $x=5;

Data types:
Supports string, float, boolean, int, array, object, null, resource.

Hello world program:

Loops:
Used to perform the same task repeatedly.

For loop:
Syntax: for(init; condition; inc/dec){
                   //Statement
              }
Example:

While loop:
Syntax: while(condition){
                  //Statement
                 }
Example:

Do-While loop:
Syntax: do{
                   //Statement
                 }while(condition)
Example:

Conditional execution:
Checks the condition.

If:
Syntax: if(Condition){
                          //Statement
                                 }
Example:

If-else:
Syntax: if(Condition){
                                        //Statement
                                 }
               else{
                        //Statement
                      }
Example:

Switch:
Syntax: Switch(no):{
                   Case 1 : Statement; break;
                   Case 2 : Statement; break;
                             .             .   .......
                   Default : Statement; break;
                         }
Example:

Functions and calling functions:
A piece of code that takes input and produces output.


Starting index of string:

Sub-string:

Replacing a string:

User input:

File creating and writing:

File reading:


Mathematical functions:
Abs(): Returns the absolute value.
Ceil(): Returns a no up to nearest no.
Pow(): Returns the power of a no.
Sqrt(): Returns the square root of a no.
Tan(): Returns the tanget of a no.

Graphics:

First non-repeated character of a string:
Highest repeated character:

Permutation of string:
Check string contains no or not:

Pyramid:

Sum of no from string:

Data base connection:
First check the version of php.
Download the driver for sql server.
After extracting the files will be in the folder.
Paste here.

Open the xampp.
Save the program in XAMPP->HTDOCS WITH .PHP.



You Might Also Like