phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


PHP Operators: Assignment Operators Table

Tag: operator, Assignment Operators   Category: PHP Basic
post: 08 Mar 2008 read: 247


PHP Operators Step By Step Tutorial - Part 4: Assignment operator Table:
Operator Info Example
= Placing right side to left side $r = 87
+= Enhancing right side to left side $r += 42
-= Tapering down right side to left side $r -= 10
*= Multiply right side to left side $r *= 2
/= Allot right side to left side $r /= 7
%= Putting down the result of modulus between left side variable value with right side value in left $r %= 1 or
$r : = $r % 2
&= Putting down the result of operation the "AND" operator to the left side variable value with right side value in left. $x &= $y or
$x :=$x & $y
|= Putting down the result of operation the "OR" operator to the left side variable value with right side value in left $x |= $y or
$x : = $x | $y
^= Putting down the result of operation the "XOR" operator to the left side variable value with right side value in left $x ^= $y or
$x : = $x ^ $y
.= Putting down the result of operation the "CONCAT" operator to the left side variable value with right side value in left >$x .= "more text" or
$x : = $x."more text"

Pay attention to the example of using assignment operator at script as following:

File name: assignmentoperator1.php


<html>
<head>
<title>Using Assignment Operator</title>
</head>

<body>
<h1>Operator Assignment</h1>
<?
	$x = 15;
	echo ("\$x = $x <br>");
	$x += 1 ;
	echo ("\$x += 1 = $x <br><br>");
	$x = 7;
	echo ("\$x = $x <br>");
	$x = $x + 2;
	echo ("\$x = \$x + 2 = $x <br><br>");
	$x = 87;
	echo ("\$x = $x <br>");
	$y = &$x;
	echo ("\$y = &\$x = $x <br><br>");
	$greeting = "good";
	echo ("\$greeting = $greeting <br><br>");
	$greeting .="night";
	echo ("\$greeting .= good = $greeting");
?>
</body>
</html>

The result of executing assignment operator.php:

assignment operator


Series this article:
PHP Operators: Introduction
PHP Operators: Arithmetic Operators
PHP Operators: Assignment Operators
PHP Operators: Assignment Operators Table
PHP Operators: Bitwise Operators
PHP Operators: Relation Operators
PHP Operators: Ternary Operator
PHP Operators: Error Control Operator
PHP Operators: Execution Operator
PHP Operators: Increment or Decrement Operator
php Operators: Logic Operator
PHP Operators: String Operator
PHP Operators: Array Operator
PHP Operators: Object Operator
PHP Operators: Operator Priority
PHP Constants: Introduction

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
CAPTCHA - part 3 : "Are you human or ....?" (Build Your CAPTCHA)

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting