note 115557 added to language.oop5.references

From: Date: Fri, 15 Aug 2014 10:51:36 +0000
Subject: note 115557 added to language.oop5.references
Groups: php.notes 
Request: Send a blank email to php-notes+get-200193@lists.php.net to get a copy of this message
To pass object by value use a clone in function/methods (on \DateTime example): <?php function datetime2Date(\DateTime $date) { $date = clone $date; $date->setTime(0, 0, 0);// do something with value return $date } function datetime2DateWithTodayDefault(\DateTime $date=null) { $date = isnull($date) ? new \DateTime : clone $date; $date->setTime(0, 0, 0); // do something with value and now default return $date; } ?> ---- Server IP: 72.52.91.14 Probable Submitter: 185.46.149.83 ---- Manual Page -- http://php.net/manual/en/language.oop5.references.php Edit -- https://master.php.net/note/edit/115557 Del: integrated -- https://master.php.net/note/delete/115557/integrated Del: useless -- https://master.php.net/note/delete/115557/useless Del: bad code -- https://master.php.net/note/delete/115557/bad+code Del: spam -- https://master.php.net/note/delete/115557/spam Del: non-english -- https://master.php.net/note/delete/115557/non-english Del: in docs -- https://master.php.net/note/delete/115557/in+docs Del: other reasons-- https://master.php.net/note/delete/115557 Reject -- https://master.php.net/note/reject/115557 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#200193) next »