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)!