Re: Array dereferencing of scalars

From: Date: Wed, 10 Jun 2015 06:53:24 +0000
Subject: Re: Array dereferencing of scalars
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-86537@lists.php.net to get a copy of this message
Hi! > <?php > $foo = 42; > $foo['bar']; // => NULL > $v = NULL; > $v[0][1][2][3][4][5][6][7][8][9]; // NULL > > this code is semantically wrong and I would like to have error/exception > for such > erroneous codes. It's inconsistent with array object, too. Why it's wrong? You try to get that's something not there, you get NULL. I don't see anything wrong. Adding fatal error about every little thing that isn't as expected never was how PHP worked. -- Stas Malyshev smalyshev@gmail.com

« previous php.internals (#86537) next »