php追加到数组
$myArr = [1, 2, 3, 4];
array_push($myArr, 5, 8);
print_r($myArr); // [1, 2, 3, 4, 5, 8]
$myArr[] = -1;
print_r($myArr); // [1, 2, 3, 4, 5, 8, -1]
php将元素追加到数组中
array_push($cart, 13);
在php中添加项目到数组
<?php
$a=array("red","green");
array_push($a,"blue","yellow");
print_r($a);
?>
php添加到数组
$fruits = ["apple", "banana"];
// array_push() function inserts one or more elements to the end of an array
array_push($fruits, "orange");
// If you use array_push() to add one element to the array, it's better to use
// $fruits[] = because in that way there is no overhead of calling a function.
$fruits[] = "orange";
// output: Array ( [0] => apple [1] => banana [2] => orange )
php添加元素到数组
<?php
$stack = array("orange", "banana");
array_push($stack, "apple", "raspberry");
?>
array_push php
<?php
$cesta = array("laranja", "morango");
array_push($cesta, "melancia", "batata");
print_r($cesta);
?>