note 109819 added to language.operators.increment
| From: | michieledthalentcirclenl | Date: | Fri, 24 Aug 2012 07:39:17 +0000 |
| Subject: | note 109819 added to language.operators.increment | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-190204@lists.php.net to get a copy of this message | ||
BEWARE:
If incrementing an uninitialized variable you will not get an E_NOTICE error. This may caused you to
not find issue's like the visibility of a property.
<?php
class a {
private $foo = 1;
}
class b extends a {
public function inc() {
echo ++$this->foo;
}
}
$b = new b;
$b->inc();
?>
Will output 1 and not 2 (if $foo was accessible).
Also no notices are given.
----
Server IP: 69.147.83.197
Probable Submitter: 194.151.159.211
----
Manual Page -- http://www.php.net/manual/en/language.operators.increment.php
Edit -- https://master.php.net/note/edit/109819
Del: integrated -- https://master.php.net/note/delete/109819/integrated
Del: useless -- https://master.php.net/note/delete/109819/useless
Del: bad code -- https://master.php.net/note/delete/109819/bad+code
Del: spam -- https://master.php.net/note/delete/109819/spam
Del: non-english -- https://master.php.net/note/delete/109819/non-english
Del: in docs -- https://master.php.net/note/delete/109819/in+docs
Del: other reasons-- https://master.php.net/note/delete/109819
Reject -- https://master.php.net/note/reject/109819
Search -- https://master.php.net/manage/user-notes.php