Home  >  Article  >  Backend Development  >  Detailed explanation of the steps to operate PHP associative arrays and index arrays

Detailed explanation of the steps to operate PHP associative arrays and index arrays

php中世界最好的语言
php中世界最好的语言Original
2018-05-18 13:46:472488browse

This time I will give you a detailed explanation of the steps for operating PHP associative arrays and index arrays. What are the precautions for operating PHP associative arrays and index arrays? . The following is a practical case, let's take a look.

Data

username password 
test 123456

Associative array:

 mysql_fetch_assoc()
 array([username]=>'test',[password]=>'123456')

Index array:

mysql_fetch_array()
array([0]=>'test',[1]=>'123456')

var_export()

array ( 0 => 1, 1 => 'a', 2 => 'hello', )

var_dump()

array(3) { [0]=> int(1) [1]=> string(1) "a" [2]=> string(5) "hello" }

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

bindParam and bindValue are analyzed using steps in Yii2

##php method to extract a single value from an array

The above is the detailed content of Detailed explanation of the steps to operate PHP associative arrays and index arrays. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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