Php--explode application (get string, split as drop-down list)

Source: Internet
Author: User
Tags explode

<?PHP//define a function with a default value functionMain3 ($f=5,$g=6) {     Echo $f*$g; } Main3 (2,3); Echo"<br/>"; //functions with variable parameters (the number of parameters can be changed) functionMain4 () { for($i= 0;$i<Func_num_args();$i++)    {        $array=Func_get_args();//gets the input parameter, which is an array        Echo $array[$i]." <br/> "; }} Main4 (1,2,6);//the number of parameters can be changed//function parameterized (in other languages called proxies or delegates)functionIndex2 () {Echo"BB"; }@$hanshu=index2;//function Variable parameterEcho $hanshu();//parametric variable function//Direct output    Echo"<br/>"; STR ($hanshu); functionStr$a) {     Echo $a(); }//by method call?>

Shorthand code

<?PHP$s= "n001^ han |n002^ hui |n003^ Manchu |n004^ Uighur"; //break out each row of data    $array=Explode("|",$s); $str= "<select>";  for($i= 0;$i<Count($array);$i++)    {        $hang=$array[$i];//data for each row                $lie=Explode("^",$hang);//to remove an array of columns based on Rows                $str=$str." <option value= ' ".$lie[0]. "' > ".$lie[1]. " </option> "; }        $str=$str." </select> "; Echo $str;?>

Php--explode application (get string, split as drop-down list)

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.