Re: Bitwise solution?
| From: | Harshdeep S Jawanda | Date: | Fri, 02 Mar 2001 06:01:57 +0000 |
| Subject: | Re: Bitwise solution? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-42298@lists.php.net to get a copy of this message | ||
Hi,
"Boget, Chris" wrote:
> I have 2 values. The first is a constant while the second is not.
Is the first value a numerical value (real/integer?) or a string value?
If it is numerical, then one of the things you could do for using a
numerical value of (say) less than 100 could be:
$finalVar = ($var2 * 10) + $var2;
This is one of the simplest things you could do and meant only as a
rough example. A faster way would be to right-shift by 4 (if that can be
done in PHP) instead of multiplying by 10. This well essentially
multiply the number by 16.
I am relatively new to PHP, so the syntax I have used may not be
correct. Sorry about that.
Does this come anywhere close to what you would like to do?
--
Regards,
Harshdeep Singh Jawanda.