Hello Steve,
Thursday, October 25, 2001, 10:30:16 PM, you wrote:
SC> On Thursday, October 25, 2001, at 02:08 PM, Mart�n Marqu�s wrote:
>> On Jue 25 Oct 2001 15:36, you wrote:
>>> Hello php-general,
>>>
>>> I have such code:
>>>
>>> class A
>>> {
>>> var $xxx;
>>>
>>> function print()
>>> {
>>> echo $xxx;
>>
>> $xxx is internal to the print function. Instead you need $this->xxx
>> which
>> will give you the value of the $xxx of the A class.
>>
>>> }
>>> }
>>>
>>> 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?
>>
>> Th print function of PHP has nothing to do with this, just because
>> print is
>> internal to the A class, and has nothing with the PHPs internal print
>> function.
SC> Hmm. I think you're wrong here. I made this test script:
SC> <?php
SC> class test {
SC> var $a;
SC> function test() {
SC> $this->a = "hello";
SC> }
SC> function print() { // this is line 10
SC> echo $this->a;
SC> }
SC> }
SC> $obj = new test;
$obj->>print();
?>>
SC> Which gives this:
SC> Parse error: parse error, expecting `T_STRING' in
SC> /home/httpd/html/ucdamage/test.php on line 10
SC> If I change the name of the print() method it works okay.
SC> -Steve
I told you! :) I'm sure I was right when I said that was because
print() is not actually a function, it's a language constructuin...
--
Best regards,
Olexandr 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]