Home > Backend Development > PHP Tutorial > PHP method to add multiple variables to the end of the array through the array_push() function_PHP tutorial

PHP method to add multiple variables to the end of the array through the array_push() function_PHP tutorial

WBOY
Release: 2016-07-13 10:02:34
Original
1440 people have browsed it

How to add multiple variables to the end of an array in php through the array_push() function

This article mainly introduces how to add multiple variables to the end of an array in php through the array_push() function The method involves the skills of array_push() function in php to operate arrays. Friends who need it can refer to it

The example in this article describes how PHP adds multiple variables to the end of the array through the array_push() function. Share it with everyone for your reference. The specific analysis is as follows:

php adds multiple variables to the end of the array through the array_push() function. The array_push function accepts any number of variables to add.

?

1

2

3

4

5

6

7

8

9

$alpha = array("a", "b", "c");

$final = array_push($alpha, "d","e");

print "There are $total elements in $alpha

";

foreach ( $alpha as $val ) {

print "$val
";

}

print "

";

?>

1 2

3

4 5

67 8 9
$alpha = array("a", "b", "c"); $final = array_push($alpha, "d","e");

print "There are $total elements in $alpha

";

foreach ( $alpha as $val ) { print "$val
"; } print "

"; ?>
I hope this article will be helpful to everyone’s PHP programming design. http://www.bkjia.com/PHPjc/969960.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/969960.htmlTechArticlephp method of adding multiple variables to the end of the array through the array_push() function. This article mainly introduces php through array_push The () function adds multiple variables to the end of the array, involving a... in php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template