PHP Array function-array_push ()

Source: Internet
Author: User
The Array_push () function inserts one or more elements into the end of the array (into the stack). Tip: You can add one or more values. Note: Even if your array has a string key name, the element you are adding will be a numeric key name. Array_push (Array,value1,value2 ...); Array: Required. Specify an array value1: Required. Specifies the value to add value2: Optional. Specifies the value to be added return value: Returns the number of elements of the new array <?php
$a = array("a" = "red", "b" = "green");
Echo ' The number of array elements after adding is: '. Array_push ($a, "blue", "yellow"). " <br> ";
Print_r ($a);
?> output: The number of elements added after the array is: 4Array ([a] + = red [b] = green [0] = blue [1] = yellow)

PHP Array function-array_push ()

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.