Re[6]: Need a more elegant way of bitwise ORing values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Robert,

Wednesday, June 13, 2007, 3:15:39 PM, you wrote:

> It's terribly verbose and inefficient...

> <?php

> $filter['flags'] = 0;

> if( $allow_fraction )
> {
>     $filter['flags'] |= FILTER_FLAG_ALLOW_FRACTION;
> }

> if( $allow_thousand )
> {
>     $filter['flags'] |= FILTER_FLAG_ALLOW_THOUSAND;
> }

> if( $allow_scientific )
> {
>     $filter['flags'] |= FILTER_FLAG_ALLOW_SCIENTIFIC;
> }

?>>

I don't think it's *terribly* verbose, as it has good sentence structure
to it, but your version is certainly more efficient, hence I've
swapped to that. Any other takers? ;)

Cheers,

Rich
-- 
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux