|
Posted by vinnie on 05/28/07 21:36
This is my first "class" algorithm: when i execute it, i get this
error:
<<Fatal error: Call to undefined function: sum() in d:\class.php on
line 20>>
what's wrong? The class has the function, so why it says undefined?
<?php
print("first time class");
class somma
{
var $uno=10;
var $due=15;
var $tre=15;
function sum($uno, $due, $tre)
{
$totale = $uno + $due + $tre;
return($totale);
}
function sum_2()
{
$totale = $this->sum($this->uno, $this->due, $this->tre);
return $totale;
}
}
$sum=sum(34,40);
print("$sum");
?>
Navigation:
[Reply to this message]
|