Re: assignment operator works for comparison??

From: Date: Tue, 10 Apr 2001 21:29:22 +0000
Subject: Re: assignment operator works for comparison??
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-48083@lists.php.net to get a copy of this message
> > > if($shiny = 0){ > This does not compare anyting, it assigns 0 to $shiny yes i know, but shouldnt this operation return true? > > > echo( $shiny ) // this will return 0 > That's normal, you just assign 0 to it ;) > > = assignment operator > == comparison operator > > py > > > At 01:53 PM 4/10/01 -0700, you wrote: > >This confused me for awhile, because the single equal sign seemed to work > >for comparison, but created inexplicable errors in my programs. It seems > >strange to me that a successful variable value assignment does not return > >true. > > > >example: > > > ><? > > > > $shiny = 1; > > if($shiny = 0){ echo("This wont print"); } > > echo( $shiny ); //this will return 0 > > > >?> > > > >--Dan > > > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > >For additional commands, e-mail: php-general-help@lists.php.net > >To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > + ====================== > + Pierre-Yves Lem@ire > + E-MedHosting.com > + (514) 729-8100 > + pylem@sympatico.ca > + ====================== > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#48083) next »