Beginner guide of PHP General Types

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

Case Sensitivity:-

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.

Integers:-

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:-

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:-

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.

((result)) —
boolean true
boolean false

Constants:-

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.

//integer
$var = 1;

//float
$var += 0.1; //1.1

//string
$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

Rajesh Kumar
Follow me