a class's function's parameter's scope issue
| From: | Eric Peters | Date: | Wed, 16 Aug 2000 18:28:36 +0000 |
| Subject: | a class's function's parameter's scope issue | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-29176@lists.php.net to get a copy of this message | ||
The Error:
Parse error: parse error in c:\program files\apache group\apache\htdocs\test.php on line 12
The Script:
<?php
class Test {
var $table;
function Test()
{
$table = "kewl";
}
function hello($tableName = $this->table)
{
echo $tableName . "<BR>\n";
}
}
$one = new Test;
$one->hello();
?>
The Problem:
I can substitute $this->table with "something" and the script will work
The problem I'm having is $this isn't addressable in the definition
without this ability I don't have a very good encapsilation in my code and
those variables that would be set need to be done in as a global variable
blah blah ok ok the problem is known - I hope i'm just fubaring something
up royally and what I want to do I can ;p
or what am I gunna hafta alter in the code to do it...doh!
or better yet how much would I have to pay someone to get it coded ;p
Eric