note 110850 added to language.operators.increment

From: Date: Fri, 14 Dec 2012 15:06:50 +0000
Subject: note 110850 added to language.operators.increment
Groups: php.notes 
Request: Send a blank email to php-notes+get-192532@lists.php.net to get a copy of this message
<?php in reply to previous note... class a { private $foo = 1; } class b extends a { public function inc() { echo ++$this->foo; } } $b = new b; $b->inc(); ?> $foo is private, so can't be accessed by its children. Simply change private for protected and ++$this->foo equals 2. ---- Server IP: 69.147.83.199 Probable Submitter: 84.16.66.35 ---- Manual Page -- http://php.net/manual/en/language.operators.increment.php Edit -- https://master.php.net/note/edit/110850 Del: integrated -- https://master.php.net/note/delete/110850/integrated Del: useless -- https://master.php.net/note/delete/110850/useless Del: bad code -- https://master.php.net/note/delete/110850/bad+code Del: spam -- https://master.php.net/note/delete/110850/spam Del: non-english -- https://master.php.net/note/delete/110850/non-english Del: in docs -- https://master.php.net/note/delete/110850/in+docs Del: other reasons-- https://master.php.net/note/delete/110850 Reject -- https://master.php.net/note/reject/110850 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#192532) next »