PHP array_push () array function: Press one or more cells into the end of the array (into the stack) _php tutorial

Source: Internet
Author: User
Copy CodeThe code is as follows:
/* Function Array_push (): Presses one or more cells into the end of the array (into the stack)
* 1, Syntax: int array_push (array &array, mixed var [, mixed ...])
* 2, Description: The array is treated as a stack, and the incoming variable is pressed into the end of the array. The length of the array will increase depending on the number of variables that are in the stack.
* 3. Precautions:
* 3.1, the function returns the total number of new elements in the array
* 3.2, such as an array of Var, the array is used as a variable in the stack into the array stack, that is, the length of the original array is to add a unit
*/

echo "***********************************************************************
";
$arr 11=array (' score 1 ' =>65, ' score 2 ' =>25, ' score 3 ' =>87, ' score 4 ' =>85, ' score 5 ' =>45, ' score 6 ' =>66);
$arr 22=array (a,b,c,d,e);
echo "Array arr11 information:";
echo "


echo "
";
echo "Array arr22 information:";
echo "


echo "
";
echo "Array arr1 the number of original elements is:". Count ($arr 11). "
";
$num 1=array_push ($arr 11,12,55,66,100);
echo "In the stack, the total number of elements of the array is:". $num 1. "! The elements of this array are:
";
echo "


echo "
";
$num 2=array_push ($arr, $arr 22);
echo "Array arr22 into the stack after array arr11:";
echo "In the stack, the total number of elements of the array is:". $num 2. "! The elements of this array are:
";
echo "


echo "
";
?>

The results of the operation are as follows:

http://www.bkjia.com/PHPjc/323845.html www.bkjia.com true http://www.bkjia.com/PHPjc/323845.html techarticle Copy the code as follows:? PHP/* Function Array_push (): Press one or more cells into the end of the array (into the stack) * 1, Syntax: int array_push (array lt;br "; $arr 11=array (' score 1 ' = ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.