Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 20th, 2005, 09:01 AM
Authorized User
Join Date: Dec 2004
Location: Dallas, TX, USA.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ababb
Default Rules on use of == double equals (see p142, 146)

Do you know the rationale for the use of double equals sign? Is it PHP syntax that requires it?

In what situations is it required?

Dallas TX
Dallas TX
  #2 (permalink)  
Old January 20th, 2005, 05:58 PM
Friend of Wrox
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts

The double equals signs are to test for equality between two variables and/or values. A single equals sign is used for assignment.

//"set variable1 to 'value'"
$variable1 = "value";

//"if variable1 is 'value' do something()"
if($variable1 == 'value')

//this is probably not what you want to do:
//"if variable1 is successfully set to 'value' do something()"
if($variable1 = 'value')

//and this will cause an error - think of it as a sentence fragment
$variable1 == 'value';

-Snib - http://www.snibworks.com
Where will you be in 100 years?

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with equals() and == praveena Java Basics 7 June 15th, 2007 08:05 AM
Try It Out Page 146 Chapter 5 sosborne BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 1 August 7th, 2006 05:53 PM
how to override equals() and hashcode() praveena Java Basics 3 March 14th, 2006 02:30 AM
SQL "equals operator" in queries Steve777 SQL Language 1 June 24th, 2005 10:42 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.