Cómo insertar un array asociativo en php

Ejemplos de código

4
0

php array push

array_push ( array &$array [, mixed $... ] ) : int
or
$array[] = $var;
2
0

array_push php


<?php
$cesta = array("laranja", "morango");
array_push($cesta, "melancia", "batata");
print_r($cesta);
?>

0
0

php añadir al array asociativo existente


$a1=['aa'=>'123' , 'bb'=>'454'];

$a1 = array_merge( $a1 , ['a'=>1,'b'=>2] ) ;
0
0

array push en php

$cart = array();
$cart[] = 13;
$cart[] = 14;
// etc

//Above is correct. but below one is for further understanding
$cart = array();
for($i=0;$i<=5;$i++){
    $cart[] = $i;  
}
echo "<pre>";
print_r($cart);
echo "</pre>";
0
0

php de inserción de matriz


<?php

$a=array("red","green");

array_push($a,"blue","yellow");

print_r($a);
?>
 

En otros idiomas

Esta página está en otros idiomas

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................