Website Templates Search

Php Basics

In Php, Scalar Type Declarations two different types options :

1. Coercive mode : coercive mode is a default mode and need not to be specified.

2. Strict mode : Strict mode need to be explicitly type hinted....

In Php trait is a new concept which is introduced to achieved multiple inheritance.

trait are created using trait keyword followed by the name of trait.

you can define variables, methods,abstract methods in trait, you can define everything that you defined within a class definition....

Wrapping up Data Member and Member Function in a single unit is known as encapsulation....

An interface is a common structure which multiple class can implement. By using interface we can restrict classes to implement functions which are inside interface....

In this example we are showing how we can declare and use static variables and functions inside any class....

A class which is defined with abstract keyword followed by class name is Known as Abstract class.

If a class has at-least one abstract method then it becomes abstract class....

A destructor is a special member function in the class. It is used to de-allocate memory for an object created by the constructor....

In Php, Constructor is a special member function which is created by the __construct() keyword.

__construct() is automatically called when we create instance of the class.

__construct() is a “MagicMethod used to define a Constructor.

The first method of any class is Constructor method....

In PHP object oriented programming, a class can be created by using class keyword followed by the name of the class....

While | Do While | For | Foreach | Loop in php is used to execute until provided expression is true.

In PHP, four type of loop available.

1. WHILE Loop

2. DO WHILE Loop

3. FOR Loop

4. FOREACH Loop...

if else statements are very basic blocks to check condition(boolean expression) to execute appropriate block.

IF ELSE STATEMENTS :

SYNTAX:

if (booleanExpression) {
// if booleanExpression is True this code will execute
your code here….
} else {
// if booleanExpression is False this code will execute
your code here….
}...

Array is a collection of similar types of datatype.
Array is used to stores multiple values in one place.
Array contains key => value pair, each value in array assigned on a key (index).
We can fetch stored value with the use of key (index)....