note 57874 deleted from language.oop5.decon by felipe
| From: | felipe@php.net | Date: | Mon, 24 Mar 2008 22:46:55 +0000 |
| Subject: | note 57874 deleted from language.oop5.decon by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-137513@lists.php.net to get a copy of this message | ||
Note Submitter: timothyrhodes at gmail dot com
----
You are receiving that error because you are calling a function outside of your class that requires
the instantiated (object) variable "example" which doesn't exist until your class has
been constructed into an object and assigned to "example. Here is the proper solution.
<?php
function foo($bar)
{
$bar->friend();
}
class example_class
{
function example_class()
{
foo($this);
}
function friend()
{
// Uhhh :)
}
}
$example = new example_class;
?>