Home > Backend Development > PHP Tutorial > How to delete array elements in PHP?

How to delete array elements in PHP?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2023-03-02 08:54:02
Original
839 people have browsed it

Just remove both keys and values..

<code>foreach($arr as $k => $v )
{
    if($v>10)
        删除arr[$k]

}

</code>
Copy after login
Copy after login

Reply content:

Just remove both keys and values..

<code>foreach($arr as $k => $v )
{
    if($v>10)
        删除arr[$k]

}

</code>
Copy after login
Copy after login

<code>$arr = [
    'test' => 'test',
    'test1' => 'test1'
];

unset($arr['test'])

print_r($arr);

#####输出
[
    'test1' => 'test1'
]</code>
Copy after login
Related labels:
php
source:php.cn
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template