diff options
author | Xinchen Hui <laruence@php.net> | 2012-04-15 11:40:38 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@php.net> | 2012-04-17 10:06:17 +0800 |
commit | 565892d4c09ff39e96d1de16a22be21242bb83e9 (patch) | |
tree | e1b6064e2f108a66a92ab8fd8a4f0a4f6b598a81 /Zend/tests/const_dereference_003.phpt | |
parent | 739eda38cd7eee7a93ee49b8a91a96e8ee25bcc0 (diff) | |
download | php-git-565892d4c09ff39e96d1de16a22be21242bb83e9.tar.gz |
Implement const array/string dereference
RFC:https://wiki.php.net/rfc/constdereference
Diffstat (limited to 'Zend/tests/const_dereference_003.phpt')
-rw-r--r-- | Zend/tests/const_dereference_003.phpt | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Zend/tests/const_dereference_003.phpt b/Zend/tests/const_dereference_003.phpt new file mode 100644 index 0000000000..810ad14b8e --- /dev/null +++ b/Zend/tests/const_dereference_003.phpt @@ -0,0 +1,21 @@ +--TEST-- +Const array deference +--FILE-- +<?php +error_reporting(E_ALL); + +var_dump([1, 2, 3, 4,][3]); +var_dump([1, 2, 3, 4]['foo']); +var_dump([array(1,2,3), [4, 5, 6]][1][2]); + +foreach (array([1, 2, 3])[0] as $var) { + echo $var; +} +?> +--EXPECTF-- +int(4) + +Notice: Undefined index: foo in %sconst_dereference_003.php on line %d +NULL +int(6) +123 |