> -----Original Message-----
> From: Ralph Deffke [mailto:ralph_def...@yahoo.de]
> Sent: 11 August 2009 01:45
> 
> ummmm...
> try
> echo "<pre>";
> for( $i=0 ; $i<10; $i++){
>   echo "something " . (($a = $a^1) ? "red\n" : "green\n");
> }

The ^ operator is one that has an assigning version, so the above can be 
slightly shortened to:

   echo "something " . (($a ^= 1) ? "red\n" : "green\n");

Cheers!

Mike
 -- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Leeds Metropolitan University, C507, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom 
Email: m.f...@leedsmet.ac.uk 
Tel: +44 113 812 4730





To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to