Montag, 2. Juni 2014

PHP Basics: Storing Creating and storing Arrays

Arrays are very powerful. You can use them to store a set of data, compare them and update them incrementally. Here is a short example how adding is one
  1. //this file is about arrays
  2.  
  3. //empty array
  4. $ar = array();
  5. //add value "4" to first possible index
  6. $ar[] = 4;
  7. foreach ($ar as $b); {
  8. echo $b."
    ";
  9. }
  10.  
  11. //add value "5" to second index
  12. $ar[2] = 5;
  13. foreach ($ar as $b); {
  14. echo $b;
  15. }

1 Kommentar: