Bug #64444 [Opn->Nab]: Use of quantitative scalar as array.
Edit report at https://bugs.php.net/bug.php?id=64444&edit=1
ID: 64444
Updated by: kalle@php.net
Reported by: koushky at gmail dot com
Summary: Use of quantitative scalar as array.
-Status: Open
+Status: Not a bug
Type: Bug
Package: Variables related
Operating System: ubuntu 12.10
PHP Version: 5.3.23
Block user comment: N
Private report: N
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
The 'array access' syntax only works for arrays and strings, strings also got curly
braces: $str{0} to access a certain byte index in that string.
So yes, this is intended, as the behavior for usage on other types are undefined.
Previous Comments:
------------------------------------------------------------------------
[2013-03-18 06:59:52] koushky at gmail dot com
Description:
------------
If the variable is a quantitative scalar (excluding the strings) and access as
array type, php does not returned notice error.
Test script:
---------------
$array = 1;
var_dump($array[0]); // doesn't return notice error
Expected result:
----------------
NULL
Actual result:
--------------
PHP Notice: Undefined offset: 0 in Command line code on line 1
NULL
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64444&edit=1
Thread (2 messages)