Get the App
SLTechnology News&Howtos  ›  Development  › 

How to set the array with no original key name by php

Shulou Source: shulou.com Published: 2022-06-01 06:45:04 10月04日 Update

This article mainly introduces "php how to set the array without the original key name". In the daily operation, I believe many people have doubts about how to set up the array without the original key name. The editor consulted all kinds of materials and sorted out a simple and useful method of operation. I hope it will be helpful to answer the question of "how to set the array without the original key name in php". Next, please follow the editor to study!

In PHP, you can use the "array_values" function to set an array without a key name, which is used to return an array containing all the values in the array. The returned array will remove the original key name and use a numeric key with the syntax "array_values (array)".

This article operating environment: Windows10 system, PHP7.1 version, Dell G3 computer.

Php how to set the array without the original key name

The array_values () function returns an array containing all the values in the array.

The returned array will use numeric keys, starting at 0 and incremented by 1.

Grammar

Array_values (array)

Return value: returns an array containing all the values in the array.

Examples are as follows:

Output result:

At this point, the study of "how to set the array without the original key name" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Arrays learning functions values more grammar help practical next articles methods environments theories computers knowledge examples articles systems results websites Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information OPPO Reno vpn Shulou Tech Info Shulou Technology