Reply to Re: why this error?

Your name:

Reply:


Posted by Jerry Stuckle on 05/28/07 22:01

vinnie wrote:
> 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");
> ?>
>

I've marked the failing line. This line tries to call a global sum()
function with two arguments. This is a valid error; no such function
exists in the system, and you haven't defined one in the global scope.

I'm not entirely sure what you're trying to do here, so I hesitate to
give you more advice and possibly lead you astray.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация