PHP array_values Returns an array of all the values detailed and instance _php instance

Source: Internet
Author: User
Tags numeric

PHP array_values

The PHP array_values function returns all the values in the array, noting that the function will set up an array index for the new array, and the original text index will not exist. This article explains the basic syntax and usages of the array_values function.

Array_values returns all the values in the array

Basic syntax:

Array array_values (array $input)

Array_values () returns all the values in the input array and creates a numeric index for them.

Parameter introduction:

Parameters Description
Input Necessary. The specified array.

return value:

Returns an array of indexes that contain all the values.

Attention:

All of the new array returned will use a numeric index, starting with 0.

Instance:

<?php
$array = Array (
  "php" => "PHP Code",
  "HTML" => "HTML code",
  "CSS" => "CSS Code",
  "JS" => "JS Code",
);
Print_r (Array_values ($array));
>   

Run Result:

Array ([0] => PHP code [1] => HTML code [2] => CSS code [3] => JS code)

Thank you for reading, I hope to help you, thank you for your support for this site!

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.