Re: [PHP] Re: function names

2001-10-26 Thread Olexandr Vynnychenko

Hello Mike,

Thursday, October 25, 2001, 10:09:18 PM, you wrote:

MF Actually your problem is with the function itself.  In order for it to work
MF you need to use the this keyword:

MF class A {
MF var $xxx;

MF function print() {
MF echo $this-xxx;
MF }
MF }

MF You may also run into problems with calling the function print(), I don't
MF know for sure.  But the problem is that you were telling PHP to print a
MF variable that was, technically, not even initialized.

MF Mike Frazer

Yes, of course there was echo $this-xxx, but it doesn't matter, seek
deeper... Error occured on line where function print() is declared.


MF Olexandr Vynnychenko [EMAIL PROTECTED] wrote in message
MF [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hello php-general,

   I have such code:

   class A
   {
 var $xxx;

 function print()
 {
  echo $xxx;
 }
   }

   And that's what I get:
 Parse error: parse error, expecting `T_STRING' in xxx.php on line nn

   Php doesn't let any function or class member have a name which is
   already used by another function (or only function from library),
   am I right? Or maybe print has special status. Maybe that's
   because print() is actually not a function? Can anyone tell me
   something about that, please?

 --
 Best regards,
  Olexandr Vynnychenko  mailto:[EMAIL PROTECTED]








-- 
Best regards,
 Olexandrmailto:[EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: function names

2001-10-25 Thread Mike Frazer

Actually your problem is with the function itself.  In order for it to work
you need to use the this keyword:

class A {
var $xxx;

function print() {
echo $this-xxx;
}
}

You may also run into problems with calling the function print(), I don't
know for sure.  But the problem is that you were telling PHP to print a
variable that was, technically, not even initialized.

Mike Frazer




Olexandr Vynnychenko [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hello php-general,

   I have such code:

   class A
   {
 var $xxx;

 function print()
 {
  echo $xxx;
 }
   }

   And that's what I get:
 Parse error: parse error, expecting `T_STRING' in xxx.php on line nn

   Php doesn't let any function or class member have a name which is
   already used by another function (or only function from library),
   am I right? Or maybe print has special status. Maybe that's
   because print() is actually not a function? Can anyone tell me
   something about that, please?

 --
 Best regards,
  Olexandr Vynnychenko  mailto:[EMAIL PROTECTED]





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]