php array n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
PHP Array PowerPoint Presentation
Download Presentation
PHP Array

Loading in 2 Seconds...

play fullscreen
1 / 12

PHP Array - PowerPoint PPT Presentation


  • 143 Views
  • Uploaded on

PHP Array. Bayu Priyambadha, S.Kom. Array. Array is collection of data that is saved in some place together and it is can accessed using index key 2 Kinds of Array : Array with numeric index Associative Array. Array With Numeric Index. Array with numeric index Example :

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PHP Array


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
php array

PHP Array

Bayu Priyambadha, S.Kom

array
Array
  • Array is collection of data that is saved in some place together and it is can accessed using index key
  • 2 Kinds of Array :
    • Array with numeric index
    • Associative Array
array with numeric index
Array With Numeric Index
  • Array with numeric index
  • Example :

$suku = array(”Jawa”,”Sunda”,”Batak”,”Minang”);

Or

$suku[0] = ”Jawa”;

$suku[1] = ”Sunda”;

$suku[2] = ”Batak”;

$suku[3] = ”Minang”;

associative array
Associative Array
  • Array with index based on current name
  • Example :

$suku = array(“satu” => “Jawa”, “dua” => “Sunda”, “tiga” => “Batak”, “emapat” => “Minang”);

array manipulation
Array Manipulation
  • Adding Array (Push)
  • Merge Array
  • Deletion Array
  • Sorting Array
adding array push
Adding Array (Push)
  • Used to adding array data to existing array
  • PHP function : array_push()
  • Example :

$suku = array(”Jawa”,”Sunda”);

array_push($suku, ”Batak”, ”Minang”);

merge array
Merge Array
  • Used to merge two array
  • PHP function : array_merge();
  • Example :

$satu = array(”Jawa”, ”Sunda”);

$dua = array(”Batak”, ”Minang”);

$gabung = array_merge($satu, $dua);

deletion array 1
Deletion Array (1)
  • Used to delete data in array
  • PHP function : array_shift(); array_pop();
  • Example :

$suku = array(”Jawa”, “Sunda”, “Batak”);

$suku_baru = array_shift($suku);

$suku = array(”Jawa”, “Sunda”, “Batak”);

$suku_baru = array_pop($suku);

deletion array 2
Deletion Array (2)
  • How to delete the middle data?
  • PHP function : array_ splice();
  • Example :

$arr = array("zero","one", "two", "three", "four", "five", "six");

array_splice($arr,3,2);

sorting array 1
Sorting Array (1)
  • Used to sort array data
  • PHP function : sort();
  • Example :

$nama = array(”abi”,”bobo”,”cica”,”ani”);

sort($nama);

sorting array 2
Sorting Array (2)
  • asort()
  • ksort()
  • rsort()
  • arsort()
  • krsort()