note 57874 added to language.oop5.decon

From: Date: Mon, 17 Oct 2005 16:46:49 +0000
Subject: note 57874 added to language.oop5.decon
Groups: php.notes 
Request: Send a blank email to php-notes+get-97123@lists.php.net to get a copy of this message
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; ?> ---- Manual Page -- http://www.php.net/manual/en/language.oop5.decon.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57874 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57874&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57874&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57874&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57874&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57874&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57874&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57874&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57874&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#97123) next »