diff --git a/tests/array_subscription.aer b/tests/array_subscription.aer new file mode 100644 index 0000000..9aafec4 --- /dev/null +++ b/tests/array_subscription.aer @@ -0,0 +1,20 @@ +class Program { + + int main() { + int[] $arr1; + int[] $arr2 = {0, 0}; + float[] $arr3 = {1, 4.5}; + $arr1 = {1, 2, 3, 4, 5}; + $arr1[] = 6; + $arr1[] = {7}; + $arr1[] = {'test' => 8}; + $arr1[] = $arr2; + $arr3[] = {4, 5, 6.5}; + $arr3[] = 7.2; + $arr3[] = 9; + var_dump($arr1); + var_dump($arr3); + return 0; + } + +} diff --git a/tests/array_subscription.exp b/tests/array_subscription.exp new file mode 100644 index 0000000..41aef99 --- /dev/null +++ b/tests/array_subscription.exp @@ -0,0 +1,50 @@ +array(int, 9) { + [0] => + int(1) + [1] => + int(2) + [2] => + int(3) + [3] => + int(4) + [4] => + int(5) + [5] => + int(6) + [6] => + array(int, 1) { + [0] => + int(7) + } + [7] => + array(int, 1) { + [test] => + int(8) + } + [8] => + array(int, 2) { + [0] => + int(0) + [1] => + int(0) + } + } +array(float, 5) { + [0] => + float(1) + [1] => + float(4.5) + [2] => + array(float, 3) { + [0] => + float(4) + [1] => + float(5) + [2] => + float(6.5) + } + [3] => + float(7.2) + [4] => + float(9) + }