PHP array_push

alfa6661
- September 13, 2012
0 (0 votes)
Rate :
menambah satu atau lebih elemen baru di akhir array menggunakan PHP

Fungsi array_push digunakan untuk menambah satu atau lebih elemen baru di akhir array

Syntax

array_push ( $array , $var [, $... ] )
Parameter Keterangan
$array input array
$var nilai yang akan disisipkan di akhir array

Contoh

<?php
$array = array("alfa", "amir");
array_push($array, "dadang", "joko");
print_r($array);
?>

Output

Array
(
    [0] => alfa
    [1] => amir
    [2] => dadang
    [3] => joko
)

Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter

– Eric S. Raymond

Have a better explanation?

If you have comments about this post. Please write your comments below

No comments associated with this article