On Monday 11 November 2002 17:20, Tomasz Ciesielski wrote:
Hi. That's my problem:
class MYCLASS {
var $z = array();
function addOne($PRODUCT_ID,$IL,$PR) {
$this-z[$PRODUCT_ID]=array(IL = $IL,
PR = $PR);
}
function myPrice() {
$cn = 0.0;
reset($this-z);
while (list($id,$vals) = each($this-z)) {
problem here! - $cn=$cn + $vals[PR]*$vals[IL];
Be creative!
- Use print() on $vals[PR] and $vals[IL] to see what they contain
- assign them to temp variables, then assign their multiplied value to a third
temp variable, then print() all three.
- you get the idea.
}
reset($this-z);
return $cn;
}
}
Example to above:
$this-z[1] = array (IL = 1, PR = 634.4);
then function myPrice() counts $cn as 634 (not as 634.4)!!!
It works like that even when I convert $vals[PR] and $vals
[IL] to floats.
--
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design Hosting * Internet Intranet Applications Development *
/*
Bilbo's First Law:
You cannot count friends that are all packed up in barrels.
*/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php