Php method for searching specific values in multi-dimensional arrays

Source: Internet
Author: User
Php method for searching specific values in multi-dimensional arrays

  1. Public function searchArray ($ array, $ key, $ value ){
  2. Foreach ($ array as $ keyp => $ valuep ){
  3. If ($ valuep [$ key] ==$ value ){
  4. Unset ($ array [$ keyp]);
  5. }
  6. }
  7. Return $ array;
  8. }
  9. ?>

Articles that you may be interested in: Introduction to the php method for creating arrays. php uses array_unique to determine whether the same value exists in the array. php array function in_array () search for the existence of the specified value in the array php array function array_key_exists () search for the existence of the array key name php array deduplication example php function array_merge () usage example (merge similar arrays) enhanced version of the array_unique function (supports two-dimensional arrays) learning php multi-dimensional array sorting example of php multi-dimensional array sorting understanding of several array functions in php array callback filtering function array_filter () application example php extract the variable function from the array and application instance to the multi-dimensional array by a certain value of the php code from the array to randomly extract some elements of the php code using the php array for the article content php code that automatically adds links to add and delete array elements

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.