Weedpacket wrote:I wouldn't, personally. I'd pass $row_DetailRS1['bwlimit'] into the function.
And the way I'd do that would be the same way that I'm passing $roundval into the function.
function cleanupformat($bwlimit, $roundval)
{
if($roundval==$bwlimit)
{
// .... succeed
}
else
{
// .... fail
}
}
<?php cleanupformat($Detail_RS1['bwlimit'], $roundval); ?>
OK, I think I see what you are doing, but I don't think this will work for me. Or I could still be lost.
$roundval is not given a value (Actually, I believe it is a Null value "0") when being passed into the function. Therefore, when doing my test "IF" , it does not "fail", but returns a value of "0".
Do you mean that I should use the following code?
<?php cleanupformat($row_DetailRS1['bwlimit'], /*$roundval*/$row_DetailRS1['bwlimit']); ?>
While this works for the first "if" statement, I don't believe this will work for the other "if" statements, because I am never really testing what $roundval is.
In all reality, I don't really need this function at all. For the First "If" Statement, I could use this single line to get the format I am looking for.
<?php round(number_format(($row_DetailRS1['bwlimit']/10000) ,1 , ".",""))*10; ?>
However, I am trying to use this as a learning experience, because I have several ideas in my head where re-useable Code in the form of a Function should be a huge benefit.
Thanks,
Cliff