How to delete a specified element from a php array

Source: Internet
Author: User
The php Array deletes the specified element. the output Array format is as follows: Array (& nbsp; [0] & gt; Array & nbsp; (& nbsp; [uname] & gt; 00000000000000000006c738a6 & nbsp; [nick] & gt; 0xe5ad99e4b899 delete a specified element from the php array
The output array format is as follows:
Array
(
[0] => Array
(
[Uname] => commandid 000000000000000006c738a6
[Nick] => 0xe5ad99e4b899
[Gender] => 0
[Face] => 1.jpg)

[1] => Array
(
[Uname] => commandid 000000000000000006d2313d
[Nick] => 0xe992b1e4b999
[Gender] => 0
[Face] => 1.jpg)

[2] => Array
(
[Uname] => commandid 0000000000000000000006d000060
[Nick] => 0xe591a8e6888a
[Gender] => 0
[Face] => 1.jpg)

[3] => Array
(
[Uname] => commandid 0000000000000000000006e1d524
[Nick] => 0xe8b5b5e794b2
[Gender] => 0
[Face] => 1.jpg)

[4] => Array
(
[Uname] => commandid has 00000000000007859ed7
[Nick] => 0xe69d8ee4b881
[Gender] => 0
[Face] => 1.jpg)

[5] => Array
(
[Uname] => commandid 00000000000000000ff68482
[Nick] => 0xe4bd95e5b08fe6958f
[Gender] => 1
[Face] => 1.jpg)

)
This is an array of friends chain information. because friends have their own information, they need to be removed and know their uname, nick, and other information, how can I remove my information from this array. That is, I want to remove arr [5], but the subscript may change and cannot be processed by indexes. I want to remove information from an array. Online, etc. thank you

------ Solution --------------------
PHP code
foreach($ar as $k => $v) {   if ($v['uname'] == '0000000000000000000000000FF68482' && $v['nick'] == '0xe4bd95e5b08fe6958f') unset($ar[$k]);}$ar = array_values($ar); 

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.