php 中在數組中添加新元素的方法

<?php
  $a[]="one";
  $a[]="two";
  $a[]="three";
  $num=count($a);
  echo "The number of the array is:".$num.'<br>';
  foreach($a as $key=>$value){
             echo $value."<br>";
  }

?>

通過上述代碼執行結果爲:

The number of the array is:3
one
two
three


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章