Syntax for push array()
array_push(array, value1, value2, ...)
Parameter Description
array Specifies an input array
value1 Specifies the value to add
value2 Specifies the value to add
$stack = array("Orange", "Mango");
<?php
$stack = array("Orange", "Mango");
array_push($stack, "Apple", "Banana");
echo '<pre>';
print_r($stack);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>PHP string replace function</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="text-center">
<h1>How do I push multiple arrays into one array?</h1>
</div>
<br>
<div class="well">
<?php
$stack = array("Orange", "Mango");
array_push($stack, "Apple", "Banana");
echo '<pre>';
print_r($stack);
?>
</div>
<br>
</div>
</body>
</html>