> SC>
> SC> That's how you have to do it.
> SC>
> SC>
> SC> class MyClass {
> SC> var $bar;
> SC>
> SC> // This is the class's constructor
> SC> sub MyClass () {
> SC> $this->bar = $foo;
> SC> }
> SC> }
>
> I didn't think php had sub routines like perl? shouldn't that be:
>
> function MyClass(){
>   $this->bar = $foo;
> }
>
> I tried this and it does not evaluate the variable. The only way I could
get this to work was to create a function that I can pass the variable to as
one of it paramaters (see previous post)
>
> I could be wrong?
>


Is this closer to what you were looking for?
- Joe

<?PHP

 class Foo {

 var $bar;

 function mymethod(){

  global $foo;
  $this->bar = $foo;

 }

}

$foo = "hello world";

echo "<html><body>";

$cls = new foo();
$cls->mymethod();
echo $cls->bar;

echo "</body></html>";
?>


-- 
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]

Reply via email to