note 117243 added to functions.arguments

From: Date: Fri, 08 May 2015 17:27:19 +0000
Subject: note 117243 added to functions.arguments
Groups: php.notes 
Request: Send a blank email to php-notes+get-202475@lists.php.net to get a copy of this message
How to pass a class as an argument? This is simple: <?php class TMath { private $_Total; function Sum() { $this->_Total = 0; foreach (func_get_args() as $n) { $this->_Total += $n; } } function Total() { return $this->_Total; } } $myMath = new TMath(); $myMath->Sum(1,2,3); ShowTotal($myMath); function ShowTotal($aMath) { echo $aMath->Total().'<br/>'; } ---- Server IP: 72.52.91.14 Probable Submitter: 67.42.155.1 ---- Manual Page -- http://php.net/manual/en/functions.arguments.php Edit -- https://master.php.net/note/edit/117243 Del: integrated -- https://master.php.net/note/delete/117243/integrated Del: useless -- https://master.php.net/note/delete/117243/useless Del: bad code -- https://master.php.net/note/delete/117243/bad+code Del: spam -- https://master.php.net/note/delete/117243/spam Del: non-english -- https://master.php.net/note/delete/117243/non-english Del: in docs -- https://master.php.net/note/delete/117243/in+docs Del: other reasons-- https://master.php.net/note/delete/117243 Reject -- https://master.php.net/note/reject/117243 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#202475) next »