Implicit Casting in php

Many operators have expectations of their operands—for instance, binary math operators typically require both operands to be of the same type. PHP’s variables can store integers, floating-point numbers, strings, and more, and to keep as much of the type details away from the programmer as possible, PHP converts values from one type to another as … Read more

Number of Operands in php

Most operators in PHP are binary operators; they combine two operands (or expressions) into a single, more complex expression. PHP also supports a number of unary operators, which convert a single expression into a more complex expression. Finally, PHP supports a single ternary operator that combines three expressions into a single expression

Garbage Collection in php

PHP uses reference counting and copy-on-write to manage memory. Copy-on-write ensures that memory isn’t wasted when you copy values between variables, and reference counting ensures that memory is returned to the operating system when it is no longer needed To understand memory management in PHP, you must first understand the idea of a symbol table. … Read more

Variable Scope in php

The scope of a variable in php , which is controlled by the location of the variable’s declaration, determines those parts of the program that can access it. There are four types of variable scope in PHP: local, global, static, and function parameters Local scope A variable declared in a function is local to that … Read more

Variables in php

Variables in PHP are identifiers prefixed with a dollar sign ($). For example: $name$Age$_debugging$MAXIMUM_IMPACT A variable may hold a value of any type. There is no compile-time or runtime type checking on variables. You can replace a variable’s value with another of a different type: $what = “Fred”;$what = 35;$what = array(“Fred”, 35, “Wilma”); There … Read more

Booleans in php

A Boolean value represents a “truth value”—it says whether something is true or not. Like most programming languages, PHP defines some values as true and others as false. Truth and falseness determine the outcome of conditional code such as: if ($alive) { … } In PHP, the following values all evaluate to false: The keyword … Read more

Strings in php

PHP includes core-level support for creating and manipulating strings. A string is a sequence of characters of arbitrary length. String literals are delimited by either single or double quotes: ‘big dog’“fat hog” Variables are expanded (interpolated) within double quotes, while within single quotes they are not: $name = “Guido”;echo “Hi, $name\n”;echo ‘Hi, $name’; Hi, GuidoHi, … Read more

Data Types in php

PHP provides eight types of values, or data types. Four are scalar (single-value) types: integers, floating-point numbers, strings, and Booleans. Two are compound (collection) types: arrays and objects. The remaining two are special types: resource and NULL Integers Integers are whole numbers, such as 1, 12, and 256. The range of acceptable values varies according … Read more

List of Keywords in php

A keyword (or reserved word) is a word set aside by the language for its core functionality—you cannot give a variable, function, class, or constant the same name as a keyword Table to Lists the keywords in PHP, which are case-insensitive _CLASS_ echo insteadof _DIR_ else interface _FILE_ elseif isset() _FUNCTION_ empty() list() _LINE_ enddeclare … Read more