PHP General Types means Basics of PHP programming language:-
Comments & case-sensitivity Variables Includes below topic:-
Integers, Booleans, Decimals, Constants
Using built and functions determine types:-
This model are very basics some few basics:-
You can write different types of Comments symbol in PHP:-
“//” called C++ line comment
“/—————-/” called C-style comment block
“#” called Shell Style comment
Capacity names are case-unfeeling, however it is normally great structure to call works as they show up in their assertion. So as it is expressed, User-characterized capacities are not case touchy, the remainder of the language is case-sensitive though. Indeed PHP is case touchy language without a doubt.
A integer number must have at any rate one digit (0-9). No comma or spaces are allowed inside a whole number.
It must not have a decimal point.
It could be either positive or negative if no sign goes before it is thought to be certain.
Integer numbers can be determined in three organizations, decimal (10-based), hexadecimal (16-based) (prefixed with 0x) or octal (8-based) (prefixed with 0) documentation, alternatively went before by a – or + sign.
Decimal floating-point (DFP) arithmetic refers to both a representation and activities on decimal floating-point numbers. Working directly with decimal (base-10) portions can keep away from the adjusting blunders that generally normally happen when changing over between decimal divisions.
Booleans are an extremely fundamental thing, they are a simply like double. This is to state you either have a 1 or a zero, a genuine or a bogus worth. Booleans can either be valid or false, that is it. In the event that it is valid, this doesn’t implies the string genuine or the number 1, it is basically a truthy esteem. They are extremely valuable in programming since we can utilize them to perform different tests.
A constant can hold just a scalar or a simple value, for example, integer, float, string or Boolean. When a constant is characterized, it very well may be available from anyplace in the content.
Determine Variable Types:-
It changes over a variable’s information type automatically, depending on the context in which the variable is utilized. For instance, you can instate a variable with a integer value, enhance it, along these lines transforming it into a float, at that point go along with it onto a string value to deliver a string.
$var = 1;
$var += 0.1; //1.1
$var .= ‘ abc’; // 1.1 abc
is_int( ) Return true if value is an integer
is_float( ) Return true if value is a float
is_string( ) Return true if value is a string
is_bool( ) Return true if value is a boolean
is_array( ) Return true if value is a array
is_object( ) Return true if value is a object
is_resource() Return true if value is a resource
is_null( ) Return true if value is a null
is_numeric( ) Return true if value is a number (such as, a numeric string or float)
is_scalar( ) Return true if value is a null
Latest posts by Ajay K (see all)
- Inheritance in PHP with example - February 17, 2020
- Difference between Public, Private & Protected Access Modifier in PHP with example - February 17, 2020
- Insert and Retrieve data from database in PHP using MySQLI - February 13, 2020