the following code return 0, it does not do the computation. Please can anybody help? am not sure if its the string convertion that is the problem.
Been trying out various options.
Pls help
public function Report_Target_Revenue($id){
$discount=0.85; //at 15%
$days=$this->Report_Duration($id); // returns 4
$daily_rate=$this->Report_Rate($id);// returns 28
$target_del=$this->Report_Target_Delegate($id);// returns 7
$target_revenue=$days * $daily_rate * $target_del * $discount;
return $target_revenue;
php code help-- am not sure what is wrong here
Moderator: General Moderators
Re: php code help-- am not sure what is wrong here
i have tested all of them, they return the expected values.
i need some help
i need some help
- iankent
- Forum Contributor
- Posts: 333
- Joined: Mon Nov 16, 2009 4:23 pm
- Location: Wales, United Kingdom
Re: php code help-- am not sure what is wrong here
Not sure what to suggest, if all the functions are returning the correct values then it should work. When you say 'string conversion', what do you mean? Nothing there appears to be converted from a string?
I'd start by changing this line:
to this:
And see if it returns the correct value. If it does, add in * $daily_rate and try again, e.g.:
and so on until you're back to the original line.
When your function suddenly returns 0, the last variable you're multiplying by is the one causing the problem.
I'd start by changing this line:
Code: Select all
$target_revenue=$days * $daily_rate * $target_del * $discount;Code: Select all
$target_revenue=$days;Code: Select all
$target_revenue=$days * $daily_rate;When your function suddenly returns 0, the last variable you're multiplying by is the one causing the problem.
Re: php code help-- am not sure what is wrong here
many thanks.... my mistake, i was returning the value wrapped in a div;
solved now
solved now