php-src/tests/lang/foreachLoop.004.phpt
Nikita Popov 45f7b2bcc8 Fix CRLF line-endings in tests
Also fix a single instance of CRLF in ibase_query.c.
2016-11-20 22:31:24 +01:00

77 lines
826 B
PHP

--TEST--
Foreach loop tests - using an array element as the $value
--FILE--
<?php
$a=array("a", "b", "c");
$v=array();
foreach($a as $v[0]) {
var_dump($v);
}
var_dump($a);
var_dump($v);
echo "\n";
$a=array("a", "b", "c");
$v=array();
foreach($a as $k=>$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"
}