PHP search $ keyword result equals to another result PHP + mysql. for example, if I want to search for a keyword $ keyword with a value of 25*50, the results of 25*50 and 50*25 are displayed at the same time, then, the search result of 25*50*2.5 is displayed, and the result of 50*25*2.5 is displayed. (There will be 25*50*1.1 to 25*50*4.75 later) how to judge or use PHP. ------ PHP search $ keyword result equals to another result at the same time
PHP + mysql for example, if I want to search for the keyword $ keyword to 25*50, the results of 25*50 and 50*25 are displayed at the same time, then, the search result of 25*50*2.5 is displayed, and the result of 50*25*2.5 is displayed. (25*50*1.1 to 25*50*4.75)
How to judge or use PHP.
------ Solution ----------------------
What you may want is this
$ Key = '20*50 * 30'; $ arr = explode ('*', $ key); print_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*50 [5] => 30*50*20)
The above is the content of the PHP search $ keyword result that is equal to another result at the same time. For more information, see PHP Chinese network (www.php1.cn )!