earlyport.blogg.se

Php operators
Php operators











php operators

$myVar -= 5 *= Multiplication-Assignment Multiplies the left hand operand by value of the right hand operand assigning result to left hand operand $myVar = 10

php operators

$myVar += 5 -= Subtraction-Assignment Subtracts the value of right hand operand from the value of the left hand operand and assigns result to left hand operand $myVar = 10 Operator Type Description Example = Assignment Sets the value of the left hand operand to the value of the right $myVar = 30 += Addition-Assignment Adds the value of left hand operand to the value of the right hand operand and assigns result to left hand operand $myVar = 10 In this chapter of PHP Essentials we will explore each type of operator and explain how they are used in relation to their operands. After evaluating this expression the value of 4 will have been assigned to the variable $myVar. In the above example, the assignment operator (=) assigns the result of the addition to the operand represented by the variable $myVar. Operators can be combined to create complete expressions: $myVar = 1 + 3 The '+' operator adds the values of two operands (resulting in a value of 4). In this expression we have one operator (the '+') and two operands (the numbers 1 and 3). Let's take, for example, the following simple expression: 1 + 3 before and/or after the operator) depends on the type of operator in question. The number and location of these operands in relation to the operators (i.e.

php operators

Operators in PHP work with operands which specify the variables and values that are to be used in the particular operation. Operators take the form of symbols (such as + and -) and combinations of symbols (such as ++ and +=). Operators in PHP, and any other programming language for that matter, enable us to perform tasks on variables and values such as assign, multiply, add, subtract and concatenate them.

#Php operators pdf#

Purchase and download the full PDF and ePub versions of this PHP eBook for only $8.99













Php operators