“wie man assoziatives Array in PHP drückt” Code-Antworten

PHP zum assoziativen Array hinzufügen

// for php 5.4+
$data += [$key => $value];

// for php 5.4-
$data += array($key => $value);
Wrong Warbler

Array_push in PHP

<?php
// Insert "blue" and "yellow" to the end of an array:


$a=array("red","green");
array_push($a,"blue","yellow");
print_r($a);
?>
MohammadMark

PHP zu bestehender assoziatives Array hinzufügen


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

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

PHP fügen Sie dem assoziativen Array neues Element hinzu

$a = array('foo' => 'bar'); // when you create
$a['Title'] = 'blah'; // later
Sleepy Scarab

Array_push PHP

// array_push ( array &$array [, mixed $... ] ) : int
// array_push() treats array as a stack, and pushes the passed variables onto the end of array. The length of array increases by the number of variables pushed. Has the same effect as:

<?php
$array[] = $var;
?>
// repeated for each passed value.
// Note: If you use array_push() to add one element to the array, it's better to use $array[] = because in that way there is no overhead of calling a function.
Zidane (Vi Ly - VietNam)

wie man assoziatives Array in PHP drückt

$arr = array(

  "name" => "jonh",
  "Mob" => "588555",
  "Email" => "[email protected]"

);

$arr['Country'] = "United State"; 
Black Bat

Ähnliche Antworten wie “wie man assoziatives Array in PHP drückt”

Fragen ähnlich wie “wie man assoziatives Array in PHP drückt”

Weitere verwandte Antworten zu “wie man assoziatives Array in PHP drückt” auf PHP

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen