ここでは、PHPのfor文でよく使うロジックを載せています。
以下の人は見ることをおすすめします。
- for文の使い方の雰囲気を知りたい
- for文の書き方は理解したが、実際の使い方がわからない
- for文の使い方はこれさえ覚えればOKっていうものを探している
目次
$iの利用
コード①


コード②


繰り返し表示
コード①


コード②


ループごとの結果を出力
コード①


コード②


合計の出力
コード①


コード②


まとめ
for文では、4つのよく使う処理さえ覚えてしまえばOKです。
以下のよく使うロジックも覚えることをおすすめします!
- for文+if文+変数
- for文+if文+配列(多次元配列、連想配列)
あけお
あなたの挑戦を応援しています!!