开发者

PHP Strange behaviour of foreach

开发者 https://www.devze.com 2023-03-16 15:26 出处:网络
I\'ve a code: 开发者_高级运维$csv = file(\'some.csv\'); foreach($csv as $value) { echo $value; } Everything is OK until the request method was POST - then the last element of an array is missing (

I've a code:

开发者_高级运维
$csv = file('some.csv');

foreach($csv as $value)
{
    echo $value;
}

Everything is OK until the request method was POST - then the last element of an array is missing (thought it's showing properly by print_r($csv)).

What may the problem be? That's the WHOLE CODE!


Try it:

$csv = file('some.csv');

// Loop through our array
foreach ($cvs as $line_num => $line) {
    echo $line."<br />\n";
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号