1 / 11

Pemrograman Web Dasar

Pemrograman Web Dasar. Pertemuan 1 2 PHP Array. PHP Array. Indexed arrays  - Arrays with numeric index Associative arrays  - Arrays with named keys Multidimensional arrays  - Arrays containing one or more arrays. PHP Indexed Array. Sama seperti C++ index dimulai dari 0

Download Presentation

Pemrograman Web Dasar

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Pemrograman Web Dasar Pertemuan 12 PHP Array

  2. PHP Array • Indexed arrays - Arrays with numeric index • Associative arrays - Arrays with named keys • Multidimensional arrays - Arrays containing one or more arrays

  3. PHP IndexedArray Sama seperti C++ index dimulai dari 0 Pengaksesan array berdasarkan indexnya

  4. PHP IndexedArray Mengakses Server <?php $x1 = 2; $x2 = 3; $x3 = 4; echo $x1,$x2,$x3; ?>

  5. IndexedArray <?php $x = array(1,2,3); echo$x[0]; echo$x[1]; echo$x[2]; ?>

  6. IndexedArray <?php $x[0] = 1; $x[1] = 2; $x[2] = 3; echo$x[0]; echo$x[1]; echo$x[2]; ?>

  7. IndexedArray <?php$cars=array("Volvo","BMW","Toyota");$arrlength=count($cars);for($x=0;$x<$arrlength;$x++)  {  echo $cars[$x];  echo "<br>";  }?>

  8. AssociativeArray Pengaksesan array menggunakan key age=array("Peter"=>"35","Ben"=>"37","Joe"=>"43"); $age['Peter']="35";$age['Ben']="37";$age['Joe']="43";

  9. AssociativeArray <?php$age=array("Peter"=>"35","Ben"=>"37","Joe"=>"43");foreach($age as $x=>$x_value)  {  echo "Key=" . $x . ", Value=" . $x_value;  echo "<br>";  }?>

  10. Multidimensional Array <?php// A two-dimensional array:$cars = array  (  array("Volvo",100,96),  array("BMW",60,59),  array("Toyota",110,100)  );?>

  11. SEKIAN

More Related