substr in php

If you know where the data that you are interested in lies in a larger string, you can copy it out with the substr() function: $piece = substr(string, start [, length ]); The start argument is the position in string at which to begin copying, with 0 meaning the start of the string. The length … Read more

php echo

To put a string into the HTML of a PHP-generated page, use echo. While it looks— and for the most part behaves—like a function, echo is a language construct. This means that you can omit the parentheses, so the following are equivalent: echo “Printy”;echo(“Printy”); // also valid You can specify multiple items to print by … Read more

php function

A function is a named block of code that performs a specific task, possibly acting upon a set of values given to it, or parameters, and possibly returning a single value. Functions save on compile time—no matter how many times you call them, functions are compiled only once for the page. They also improve reliability … Read more

Casting Operators in php

Although PHP is a weakly typed language, there are occasions when it’s useful to consider a value as a specific type. The casting operators, (int), (float), (string), (bool), (array), (object), and (unset), allow you to force a value into a particular type Table of PHP casting operators Operator Synonymous operators Changes type to (int) (integer) … Read more

Logical Operators in php

Logical operators in php provide ways for you to build complex logical expressions. Logical operators treat their operands as Boolean values and return a Boolean value. There are both punctuation and English versions of the operators (|| and or are the same operator). The logical operators are Logical AND (&&, and) The result of the … Read more

Bitwise Operators in php

The bitwise operators act on the binary representation of their operands. Each operand is first turned into a binary representation of the value, as described in the bitwise negation operator entry in the following list. All the bitwise operators work on numbers as well as strings, but they vary in their treatment of string operands … Read more

String Concatenation Operator in php

Manipulating strings is such a core part of PHP applications that PHP has a separate string concatenation operator (.). The concatenation operator appends the righthand operand to the lefthand operand and returns the resulting string. Operands are first converted to strings, if necessary. For example: $n = 5;$s = ‘There were ‘ . $n . … Read more

Arithmetic Operators in php

The arithmetic operators are operators you’ll recognize from everyday use. Most of the arithmetic operators are binary; however, the arithmetic negation and arithmetic assertion operators are unary The arithmetic operators are: Addition (+) The result of the addition operator is the sum of the two operands Subtraction (−) The result of the subtraction operator is … Read more

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