PHPEveryday.com PHP and Web Development Tutorial
What are you looking for?


PHP Operators: Assignment Operators Table


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


Tag: operator, Assignment Operators Category: PHP Basic Post : March 08th 2008 Read: 1,695 Bookmark and Share

blog comments powered by Disqus


Database Tutorial
  • Learn PHP MySQL
  • Learn PHP ADOdb
  • Learn PHP Data Object/PDO
  • Learn PHP XML
  • Learn PHP SimpleXML
Security Tutorial
  • Learn PHP Security
  • Learn HTTP Authentication
  • Learn PHPSecureSite
Framework Tutorial
  • Learn CodeIgniter
  • Learn Joomla
  • Learn Smarty
  • Learn Zend Framework
Template Tutorial
  • Learn Joomla Template
  • Learn WordPress Template
API Tutorial
  • Learn Facebook
JS Framework Tutorial
  • Learn MooTools
  • Learn JQuery
AJAX Tutorial
  • Learn AJAX in 10 Minutes
  • Learn AJAX Client Side
  • Learn AJAX PHP
  • Learn AJAX Remote Server
  • Learn AJAX Repetitive
  • Learn AJAX MySQL
  • Learn AJAX Grid
Web Services Tutorial
  • Learn Web Services NuSOAP
  • Learn Web Services WSDL
  • Learn Web Services WSDL Array
  • Learn Web Services .NET Grid
  • Learn Web Services WDDX
Package Post
  • Joomla Intro
  • Joomla Component
  • Joomla Module
  • Joomla MVC
  • Joomla MVC Backend
  • PostNuke Intro
  • Zend Framework Intro
  • Zend Framework Action
  • Zend Framework Database
  • Zend Framework Registry
  • Zend Framework Config
  • Zend Framework Login
  • Zend Framework Session
  • PHP Array Tips
  • PHP File Tips
  • PHP Email
  • PHP Ms Excel
  • PHP Pattern
  • PHP SMS
  • Flash Database
  • PHP Multitier
  • jQuery Introduction
  • jQuery Selectors
  • Portable Web Server
  • Web Mobile Intro
  • Drupal Installation
  • Drupal Configuration