オブジェクト指向を勉強していて配列作って呼び出したんですが、ループがずっと回って止まりません(表示もしません)
php
1<?php 2 3namespace App; 4 5class Parts{ 6 // Headerの要素収納配列 7 private $data = []; 8 9 public function Header(){ 10 $this->Setup(); 11 for($i= 0; $i >= count($data); $i++){ 12 echo $data[$i]; 13 } 14 } 15 16 public function Setup(){ 17 $this->data[] = [ 18 'text1', 19 'text2', 20 'text3' 21 ]; 22 } 23}
php
1<?php 2 3require_once(__DIR__ . '/config.php'); 4$parts = new App\Parts(); 5 6?> 7<DOCTYPE html> 8<html> 9 <head> 10 <meta charaset="utf-8"> 11 </head> 12 <body> 13 <div class="header"> 14 <?php $parts->Header() ?> 15 </div> 16 </body> 17</html> 18
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/02/25 08:05
退会済みユーザー
2017/02/25 08:17 編集
2017/02/25 08:53 編集
退会済みユーザー
2017/02/25 08:57
2017/02/25 09:19