There is generally various types of data types are present in php like-
Strings, Array, Boolean, Integer ,Object and Null.
Strings, Array, Boolean, Integer ,Object and Null.
- A String is a type of data. A string can contain letters, numbers or characters. A string can be short or long.
- Here is the example of string:
| <?php$stringA = “Hello World”;?> |
- An Array is a collection of data values, organized as an ordered collection of key-value pairs.
- Here is the Example of Array:
| <?php $bikes=array(“Yamaha”.”Hero”,”TVS”,”Honda”); var_dump($bikes);?> |
- The boolean data type represents only two values that can be either 1 or 0.Boolean values are used mainly to compare conditions for use in conditional statements. For example, PHP evaluates an expression, such as $a > $b, so the output is either TRUE or FALSE.
- The number which do not contain any decimal point is called Integer.
- Integer can be possitive or negative but integer do not contain any comma and blank. It can be express any of the three formats i.e. decimal, haxadecimal, octal.
| <?php$a = 65; var_dump($a); ?> |
-
An Object is a php data type size that store the data and information, object should be explicitly declare.
<?phpclass a {} |
- NULL value shows that variable has no value.
| <?php $a=”Hello!”; $a=null; var_dump($a); ?> |
No comments:
Post a Comment