Hello,
I am hoping someone can help me understand a piece of code i found. Since php is not my primary language, and what i googled returned vague results, i am unsure exactly how a number or integer value can be used directly as a boolean in a while operation.

function testfunction( $testparam )
{
        if( $testparam > 0x3F3F3FFF )
        {
        $testparam &= 0x3F3F3FFF;
        }

        do
        {
         $testparam >>= 6;

        }while($testparam);
}

Basically i need to be able to understand the logic of the while loop here, does it check it testparam is > 0 and evaluate that as true or false? or how does it come to its boolean value from a value that is previously recognised as an integer? Any help would be good thanks :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.