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

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

 



Hi Tijnema,

Wednesday, June 13, 2007, 2:42:28 PM, you wrote:

> Nice one, but you could also do it like this:

> <?php
> $filter['flags'] = FALSE;

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

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

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

?>>

> Little bit simpler huh?

Yup.. even nicer, I'm using that method now :)

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