PHP Search $keyword results at the same time equal to another result

Source: Internet
Author: User
PHP Search $keyword Results equal to another result
Php+mysql For example I want to search for keywords $keyword for 25*50 results in both 25*50 and 50*25, and then continue searching 25*50*2.5 results also show 50*25*2.5 results. (25*50*1.1 to 25*50*4.75 later)
What kind of judgment or method is required for PHP.
------To solve the idea----------------------
That's what you might want.

$key = ' 20*50*30 '; $arr = explode (' * ', $key);p Rint_r (arrangement ($arr));//Arrange arrangementfunction arrangement ($arr = Array (), $res = ') {  if (! Is_array ($arr)) $arr = Str_split ($arr);  if (empty ($arr)) $array [] = $res;  else foreach ($arr as $k = + $v) {    unset ($arr [$k]);    foreach (Arrangement ($arr, Trim ("$res * $v", ' * ')) as $t) $array [] = $t;    $arr [$k]    = $v;  }  return  $array;}
Array (    [0] = 20*50*30    [1] = 20*30*50    [2] = 50*30*20    [3] = = 50*20*30    [4] = = 30*20*    [5] = 30*50*20)

The above is the PHP search $keyword results at the same time equal to the content of another result, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!

  • 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.