ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 废弃函数 each() 7.2+ ``` <pre class="calibre16">``` <span class="token5">function</span> <span class="token1">fun_each</span><span class="token2">(</span><span class="token">&</span>$array<span class="token2">)</span><span class="token2">{</span> $res <span class="token">=</span> <span class="token1">array</span><span class="token2">(</span><span class="token2">)</span><span class="token2">;</span> $key <span class="token">=</span> <span class="token1">key</span><span class="token2">(</span>$array<span class="token2">)</span><span class="token2">;</span> <span class="token5">if</span><span class="token2">(</span>$key <span class="token">!==</span> <span class="token5">null</span><span class="token2">)</span><span class="token2">{</span> <span class="token1">next</span><span class="token2">(</span>$array<span class="token2">)</span><span class="token2">;</span> $res<span class="token2">[</span><span class="token3">1</span><span class="token2">]</span> <span class="token">=</span> $res<span class="token2">[</span><span class="token4">'value'</span><span class="token2">]</span> <span class="token">=</span> $array<span class="token2">[</span>$key<span class="token2">]</span><span class="token2">;</span> $res<span class="token2">[</span><span class="token3">0</span><span class="token2">]</span> <span class="token">=</span> $res<span class="token2">[</span><span class="token4">'key'</span><span class="token2">]</span> <span class="token">=</span> $key<span class="token2">;</span> <span class="token2">}</span><span class="token5">else</span><span class="token2">{</span> $res <span class="token">=</span> <span class="token3">false</span><span class="token2">;</span> <span class="token2">}</span> <span class="token5">return</span> $res<span class="token2">;</span> <span class="token2">}</span> ``` ```