I have a bit type value hasFreePackage in database which stores 1 or 0.
Here is my code below, This is working on my localhost and but whenever i try to upload on live server this code doesn't work.
public function checkBitValue($hasFreePackage)
{
$hasFreePackage= ($hasFreePackage== 0x01)
if($hasFreePackage==1)
return 1;
else
return 0;
}
As live server is linux platform and i'm running windows on local. my code works on windows but not on linux So i changed my code to this code..
public function checkBitValue($hasFreePackage)
{
$FreePackage= ($hasFreePackage== 0x01)
if($FreePackage==1)
return 1;
elseif(ord($FreePackage==1))
return 1;
else
return 0;
}
but still not working. I'm using yii 1.1 php framework and php versions are different.At linux is 5.2.0 and at local (windows) is 5.7
Even simpler:
{
return $hasFreePackage ? 1 : 0;
}
Or, more clearly:
{
return $hasFreePackage ? TRUE : FALSE;
}
The rationale: 0 is FALSE; non-zero numbers are TRUE.
Still better: Keep that in mind and don't bother checking true/false value against true/false!
Caution: NULL and '' muddy up logic like this. Hence the "rationale" spoke only of numbers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With