[TYPO3-dev] Get value bits from checkbox array

Jigal van Hemert jigal at xs4all.nl
Mon Jun 14 14:59:57 CEST 2010


Stefan Frömken wrote:
> if($thisValue&pow(2,$c))...

if $c >= 1 then I'd do something like

$thisValue & (1 << ($c-1))

or

(($thisValue >> ($c-1)) & 1)

Bitwise shifting operators are a bit faster that pow()

-- 
Jigal van Hemert
skype:jigal.van.hemert
msn: jigal at xs4all.nl
http://twitter.com/jigalvh




More information about the TYPO3-dev mailing list