diff --git a/tests/core/lang/foreachLoop-004.phpt b/tests/core/lang/foreachLoop-004.phpt new file mode 100644 index 00000000..21283c9c --- /dev/null +++ b/tests/core/lang/foreachLoop-004.phpt @@ -0,0 +1,76 @@ +--TEST-- +Foreach loop tests - using an array element as the $value +--FILE-- +$v[0]) { + var_dump($k, $v); +} +var_dump($a); +var_dump($k, $v); +?> +--EXPECT-- +array(1) { + [0]=> + string(1) "a" +} +array(1) { + [0]=> + string(1) "b" +} +array(1) { + [0]=> + string(1) "c" +} +array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" +} +array(1) { + [0]=> + string(1) "c" +} + +int(0) +array(1) { + [0]=> + string(1) "a" +} +int(1) +array(1) { + [0]=> + string(1) "b" +} +int(2) +array(1) { + [0]=> + string(1) "c" +} +array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" +} +int(2) +array(1) { + [0]=> + string(1) "c" +} diff --git a/tests/core/lang/func_get_arg-001.phpt b/tests/core/lang/func_get_arg-001.phpt new file mode 100644 index 00000000..3ab0690e --- /dev/null +++ b/tests/core/lang/func_get_arg-001.phpt @@ -0,0 +1,18 @@ +--TEST-- +func_get_arg test (PHP7) +--FILE-- + +--EXPECT-- +5 diff --git a/tests/core/lang/func_get_arg_variation.phpt b/tests/core/lang/func_get_arg_variation.phpt new file mode 100644 index 00000000..bcd9fe80 --- /dev/null +++ b/tests/core/lang/func_get_arg_variation.phpt @@ -0,0 +1,29 @@ +--TEST-- +func_get_arg test +--FILE-- +getMessage() . \PHP_EOL; + } + + try { + echo func_get_arg(2); + } catch (\Error $e) { + echo $e->getMessage() . \PHP_EOL; + } +} + +function main() { + foo(2); +} + +?> +--EXPECT-- +func_get_arg(): Argument #1 ($position) must be greater than or equal to 0 +func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function