note 54315 added to functions.arguments

From: Date: Thu, 30 Jun 2005 09:59:49 +0000
Subject: note 54315 added to functions.arguments
Groups: php.notes 
Request: Send a blank email to php-notes+get-91193@lists.php.net to get a copy of this message
(in reply to benk at NOSPAM dot icarz dot com / 24-Jun-2005 04:21) I could make use of this assignment, as below, to have a permanently existing, but changing data block (because it is used by many other classes), where the order or the refreshed contents are needed for the others: (DB init done by one, an other changed the DB, and thereafter all others need to use the other DB without creating new instances, or creating a log array in one, and we would like to append the new debug strings to the array, atmany places.) class xyz { var argN = array(); function xyz($argN) { $this->argN = &$argN; } function etc($text) { array_push($this->argN, $text); } } class abc { var argM = array(); function abc($argM) { $this->argM = &$argM; } function etc($text) { array_push($this->argM, $text); } } $messages=array("one", "two"); $x = new xyz(&$messages); $x->etc("test"); $a = new abc(&$messages); $a->etc("tset"); ... ---- Manual Page -- http://www.php.net/manual/en/functions.arguments.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+54315 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54315&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54315&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54315&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54315&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54315&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54315&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+54315&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#91193) next »