PHP 配列を回すならforかforeachか

PHP 配列を回すならforかforeachかという話、PHPの種ブログでも一度取り上げたのを、

同じ処理が行える時、forを使うかforeachを使うか?

今回、PHP 配列を回すならforかforeachか | Shin x blogの記事を見て思い出しました。
この記事のコメントにある、

私はforeach派ですかね。
・無限ループがありえない
この理由が大きいかと。

という派ですね。私も。自分で組んでてもforeachのほうが間違いが少なくてすみ、思考量も少なくてすむ(^_^;)気がします。

関連する記事:

Powered by

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">