the function with the same name as the class is the
constructor and is called when the instance is created.
So "$first = new first" runs first::first() without passing
any parameters hence the warning.

Tim Ward
http://www.chessish.com
mailto:[EMAIL PROTECTED]
----- Original Message -----
From: Chris Hayes <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 03, 2003 7:35 PM
Subject: Re: [PHP] Help with classes (oop)


> Apparently it does not like the function name to be the same as the class
> name. So change one of them.
>
> ><? php;
> >class first
> >{
> >         var $age;
> >         var $name;
> >
> >         function first($age, $name)
> >         {
> >                 return $age.$name;
> >         }
> >}
> >
> >//main script
> >$first = new first;
> >$test=$first->first(35, "chris");
> >
> >print $test;
> ?>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to