note 119971 added to language.oop5.decon

From: Date: Fri, 30 Sep 2016 13:59:15 +0000
Subject: note 119971 added to language.oop5.decon
Groups: php.notes 
Request: Send a blank email to php-notes+get-206711@lists.php.net to get a copy of this message
Most of the time we use class A { var $variable = ''; public function __construct() { $this->variable = 420; } } Instead we can use directly class A { var $variable = 420; } Why do we need to initialize it in constructor (if we do not need to assign explicitely while creating an object). ---- Server IP: 72.52.91.14 Probable Submitter: 182.74.123.66 ---- Manual Page -- http://php.net/manual/en/language.oop5.decon.php Edit -- https://master.php.net/note/edit/119971 Del: integrated -- https://master.php.net/note/delete/119971/integrated Del: useless -- https://master.php.net/note/delete/119971/useless Del: bad code -- https://master.php.net/note/delete/119971/bad+code Del: spam -- https://master.php.net/note/delete/119971/spam Del: non-english -- https://master.php.net/note/delete/119971/non-english Del: in docs -- https://master.php.net/note/delete/119971/in+docs Del: other reasons-- https://master.php.net/note/delete/119971 Reject -- https://master.php.net/note/reject/119971 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#206711) next »