php add element to array
<?php
$stack = array("orange", "banana");
array_push($stack, "apple", "raspberry");
?>
php add element to array
<?php
$stack = array("orange", "banana");
array_push($stack, "apple", "raspberry");
?>
php add item to array
<?php
$z = ['me','you', 'he'];
array_push($z, 'she', 'it');
print_r($z);
?>
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);
?>
php array append
<?php
$stack = array("orange", "banana");
array_push($stack, "apple", "raspberry");
print_r($stack);
?>
php add to array
$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>";
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us