From Abdelkarim, 2 Years ago, written in PHP.
This paste is a reply to MultiSearch Array from Abdelkarim - view diff
Embed
  1. <?php
  2.  
  3. $arr = [['lang' => null, 'title' => 'Main kaff'],
  4. ['lang' => 'en', 'title' => 'May way'],
  5. ['lang' => 'es', 'title' => 'Mi camino'],
  6. ['lang' => 'fr', 'title' => 'Mon chaimin']];
  7.  
  8. $lang= "en";
  9. $key = "lang";
  10.  
  11. function multiSearch($arr,$lang, $key)
  12. {
  13.  
  14.    return $arr[array_search($lang,array_column($arr,$key))];
  15.    
  16. }
  17.  
  18. $x = multiSearch($arr, $lang, $key);
  19.  
  20. print_r($x);
  21.  
  22. /**
  23. Array
  24. (
  25.     [lang] => en
  26.     [title] => May way
  27. )
  28. */

Replies to Re: MultiSearch Array rss

Title Name Language When
Re: Re: MultiSearch Array Abdelkarim php 2 Years ago.