note 119765 added to migration70.new-features
| From: | prpanto at gmail dot com | Date: | Sat, 20 Aug 2016 03:25:13 +0000 |
| Subject: | note 119765 added to migration70.new-features | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-206335@lists.php.net to get a copy of this message | ||
Test with define array
test a)
define('ANIMALS', [
'dog' => [
'Bob'
],
'cat',
'bird'
]);
echo ANIMALS[1]; // bird
echo ANIMALS[1][0]; // b
echo ANIMALS[1][1]; // i
echo ANIMALS[1][2]; // r
echo ANIMALS[1][3]; // d
echo ANIMALS[1][4]; // error: Uninitialized string offset: 4
echo ANIMALS[0]; // cat
echo ANIMALS[0][0]; // c
echo ANIMALS[0][1]; // a
echo ANIMALS[0][2]; // t
echo ANIMALS[0][3]; // error: Uninitialized string offset: 4
i try to echo dog but the output is error.
test b)
define('ANIMALS', [
'dog' => [
'Bob'
],
'cat' => [
'Alice'
],
'bird' => [
'Max'
]
]);
echo ANIMALS[0]; // error: Undefined offset: 0
echo ANIMALS[1]; // error: Undefined offset: 1
echo ANIMALS[2]; // error: Undefined offset: 2
echo ANIMALS[3]; // error: Undefined offset: 3
----
Server IP: 72.52.91.14
Probable Submitter: 109.242.249.238
----
Manual Page -- http://php.net/manual/en/migration70.new-features.php
Edit -- https://master.php.net/note/edit/119765
Del: integrated -- https://master.php.net/note/delete/119765/integrated
Del: useless -- https://master.php.net/note/delete/119765/useless
Del: bad code -- https://master.php.net/note/delete/119765/bad+code
Del: spam -- https://master.php.net/note/delete/119765/spam
Del: non-english -- https://master.php.net/note/delete/119765/non-english
Del: in docs -- https://master.php.net/note/delete/119765/in+docs
Del: other reasons-- https://master.php.net/note/delete/119765
Reject -- https://master.php.net/note/reject/119765
Search -- https://master.php.net/manage/user-notes.php