Advertisement

Responsive Advertisement

PHP Object And Null

 


In PHP, Object is a compound data type (along with arrays). Values of more than one types can be stored together in a single variable. Object is an instance of either a built-in or user defined class. In addition to properties, class defines functionality associated with data.

Primary (scalar) variables, arrays and other objects can be cast to object data type using casting operator. PHP provides stdClass as a generic empty class which is useful for adding properties dynamically and casting.

Example:



Introduction to the PHP null type

The null is a special type in PHP. The null type has only one value which is also null. In fact, null indicates the absence of a value for a variable.

A variable is null when you assign null to it like this:





Post a Comment

0 Comments