note 35853 deleted from function.bcmod by didou
| From: | didou@php.net | Date: | Sat, 27 Jan 2007 16:55:47 +0000 |
| Subject: | note 35853 deleted from function.bcmod by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-122272@lists.php.net to get a copy of this message | ||
Note Submitter: mackaye at iprimus dot com dot au
----
It is correct to use $i%2 to get even and odd program control
HOWEVER
using bit level operators is better, faster and more effecient
so
TO get odd and even $num&1 is much better
To NULL any element $element^$element is also much better
For New comers
these functions are based on the binary representation of variables in memory.
It so happens that an even number always has a
0 on the end, and an odd number always has a 1 on
the end
so
1010101 &
0000001
is true