Home>Article>Backend Development> How to add, delete, check and modify php arrays

How to add, delete, check and modify php arrays

Joseph Gordon-Levitt
Joseph Gordon-Levitt Original
2019-09-28 11:49:39 2096browse

How to add, delete, check and modify php arrays

First we need to write an array using our sublime.

How to add, delete, check and modify php arrays

Let’s use dump to see the effect.

How to add, delete, check and modify php arrays

How to add, delete, check and modify php arrays

##Related recommendations: "

php array"

Let’s take a look at how to add one Data, the first thing we need to do is use $a['d']=4;.

How to add, delete, check and modify php arrays

How to add, delete, check and modify php arrays

Then let’s look at how to modify the data. We can directly use $a['b']=5 to modify it.

How to add, delete, check and modify php arrays

How to add, delete, check and modify php arrays

Then let’s look at how to delete elements in the array, use unset($a['d']); delete.

How to add, delete, check and modify php arrays

The last step is how to search. To search, we directly use echo and key-value pairs to search directly.

How to add, delete, check and modify php arrays

The above is the detailed content of How to add, delete, check and modify php 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