PHP search $ keyword result equals to another result at the same time

Source: Internet
Author: User
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 )!

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.