summaryrefslogtreecommitdiff
path: root/tests/lang/engine_assignExecutionOrder_004.phpt
diff options
context:
space:
mode:
authorZoe Slattery <zoe@php.net>2009-05-29 07:51:42 +0000
committerZoe Slattery <zoe@php.net>2009-05-29 07:51:42 +0000
commit533c6473f0028955df3c42af9a01dffc1817d553 (patch)
tree56c2cb449e8e394e1b9db0a0a1ec0ac833c2a12e /tests/lang/engine_assignExecutionOrder_004.phpt
parent2ec0e93ae8a09d5b9b751f0f1eb96da916e3c7ab (diff)
downloadphp-git-533c6473f0028955df3c42af9a01dffc1817d553.tar.gz
Engine execution order tests
Diffstat (limited to 'tests/lang/engine_assignExecutionOrder_004.phpt')
-rw-r--r--tests/lang/engine_assignExecutionOrder_004.phpt52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/lang/engine_assignExecutionOrder_004.phpt b/tests/lang/engine_assignExecutionOrder_004.phpt
new file mode 100644
index 0000000000..86bc87f9c7
--- /dev/null
+++ b/tests/lang/engine_assignExecutionOrder_004.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Evaluation order during assignments.
+--FILE--
+<?php
+
+function i1() {
+ echo "i1\n";
+ return 1;
+}
+
+function i2() {
+ echo "i2\n";
+ return 1;
+}
+
+function i3() {
+ echo "i3\n";
+ return 3;
+}
+
+function i4() {
+ global $a;
+ $a = array(10, 11, 12, 13, 14);
+ echo "i4\n";
+ return 4;
+}
+
+$a = 0; // $a should not be indexable till the i4 has been executed
+list($a[i1()+i2()], , list($a[i3()], $a[i4()]), $a[]) = array (0, 1, array(30, 40), 3, 4);
+
+var_dump($a);
+
+?>
+--EXPECT--
+i1
+i2
+i3
+i4
+array(6) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(11)
+ [2]=>
+ int(0)
+ [3]=>
+ int(30)
+ [4]=>
+ int(40)
+ [5]=>
+ int(3)
+}