[SOLVED] if statement within classes.
Posted: Mon Oct 11, 2004 5:11 am
has anyone else come across this befor or is it just me not coding correctlly within classes for php4. I know I should be using 5 but deploying on a machine I have no contorl over.
ex
The question is this. in the top if statement I just do a check for to see if the return value is true or false, pretty straigtforward but it didn't seem to work properly or inconsistantly when it did.
Solved it by doing.
where i returned the result to a variable then checked the variable.
any ideas why people?
thanks
ex
Code: Select all
<?php
class someclass
{
function someclass($num)
{
if($this->checkSomething($num))
echo "found it";
else
echo "not found";
}
function chechSomething($num)
{
//some query to check some number
if($someVal<0);
return true;
else
return false;
}
}
?>Solved it by doing.
Code: Select all
<?php
class someclass
{
function someclass($num)
{
$found=$this->checkSomething($num);
if($found)
echo "found it";
else
echo "not found";
}
function chechSomething($num)
{
//some query to check some number
if($someVal<0);
return true;
else
return false;
}
}
?>
?>any ideas why people?
thanks