Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Perl 中,您可以通过以下方式引用循环的当前变量$_
$_
例如:
my @array = (1,2,3,4); foreach(@array) { print $_." "; }
将打印:
1 2 3 4
有没有这方面的 php 等价物?
foreach ($array as $value) { echo $value . ' '; }
http://php.net/foreach