PHP is not sensitive to whitespace.

Whitespace refers to the characters you enter that are not displayed on the screen, such as spaces, tabs, and carriage returns (end-of-line characters).

It virtually never matters how many whitespace characters you have in a row since PHP is whitespace insensitive.

A single whitespace character can represent a large number of other characters.

Each of the PHP statements that assign the total of 2 + 2 to the variable $four, for example, is equal.

Statements are semicolon-separated expressions.

Tokens are combined to form expressions.

The indivisible tokens, such as integers (3.14159), strings (.two. ), variables ($two), constants (TRUE), and the specific phrases that make up the syntax of PHP itself, such as if, else, while, for, and so on, are the tiniest building blocks of PHP.

Blocks are created using braces.

Although statements cannot be coupled like expressions, you can always enclose a sequence of words in a set of curly brackets and place them anywhere a message may go.

Any expression followed by a semicolon is referred to as a statement in PHP (;).

A valid PHP programme is any series of reasonable PHP statements contained by PHP tags. Here’s an example of a PHP statement that sets a string of characters to a variable named $greeting.

A variable is the most common technique to store data in the middle of a PHP programme.

The most important things to know about variables in PHP are listed here.

A leading dollar symbol ($) signifies all variables in PHP.

A variable’s value is the result of its most recent assignment.

The = operator is used to assign variables, with the variable on the left and the expression to be evaluated on the right.

Variables can be stated before the assignment, although they are not required.

Variables in PHP don’t have inherent types, which means they don’t know if they’ll be used to hold a number or a string of characters before they’re used.

Variables with default values are those that are utilised before they are assigned.

When appropriate, PHP does a decent job of automatically converting types from one to another.

Variables in PHP are Perl-like.

We employ eight data types in PHP to create our variables.

Integers, such as 4195, are entire integers without a decimal point.

Floating-point numbers, such as 3.14159 or 49.1, are known as doubles.

True or false are the only two possible values for Booleans.

NULL is a unique type with only one value: NULL.

Strings are character sequences, such as ‘PHP supports string operations.’

Arrays are collections of other values that are named and indexed.

Objects are instances of programmer-defined classes that can package up both other types of values and class-specific functions.

Resources are unique variables that store references to resources outside of PHP (such as database connections).

The first five kinds are simple, but the following two (arrays and objects) are compound; compound types may wrap up additional arbitrary values of any type, whereas simple types cannot.

This chapter will cover basic data types, and the concepts of arrays and objects will be discussed individually.

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on vk
Share on reddit
Share on tumblr
Share on whatsapp