Array Lookup Order Lookup-php

Source: Internet
Author: User

1<?PHP2     //set the request header3     Header("Content-type:text/html;charset=utf-8");4 5     /*6 Sequential Lookups:7 Source: An array8 Requirement: Find out if there is a value, find it and return the subscript, no return hint9     */Ten  One     $arr=Array(1,6,3,100,9,100,0,7,-4,0); A  -     functionSearch (&$arr,$number 1,$number 2){ -          the         foreach($arr  as $key=$value){ -              -             if($value==$number 1){ -                 $number 1_index=$key; +                 $flag 1=true; -                 $num 1_arr[] =$key;//more than the specified bidding clubs auto-fill, starting from 0 +             } A              at             Else if($value==$number 2){ -                 $number 2_index=$key; -                 $flag 2=true; -                 $num 2_arr[] =$key; -             } -         } in  -         if($flag 1||$flag 2){ to             Echo $number 1. "There are in this array."Count($num 1_arr) . "One, the location is:".Var_dump($num 1_arr) . ' <br> '; +             Echo $number 2. "There are in this array."Count($num 2_arr) . "One, the location is:".Var_dump($num 2_arr) . ' <br> '; -             Exit; the         } *  $ Panax Notoginseng         Echo"<script>alert (' No number you're looking for!!! ') </script> "; -         Exit; the     } +  ASearch$arr, 100, 0); the  +?>

Array Lookup Order Lookup-php

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.