php輸入幾個(gè)數(shù)從大到小排序的案例?這個(gè)問題可能是我們?nèi)粘W(xué)習(xí)或工作經(jīng)常見到的。希望通過這個(gè)問題能讓你收獲頗深。下面是小編給大家?guī)淼膮⒖純?nèi)容,讓我們一起來看看吧!
php輸入幾個(gè)數(shù)從大到小排序
以下程序?qū)崿F(xiàn)了在網(wǎng)頁(yè)輸入幾個(gè)數(shù),按照從大到小排序并輸出的功能,希望對(duì)需要的朋友有幫助:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <p>請(qǐng)輸入要排序的數(shù)據(jù)</p> <form id="form1" name="form1" method="post" action=""> <input name="textfield" type="text" id="textfield" size="15" maxlength="15" />- <input name="textfield2" type="text" id="textfield2" size="15" />- <input name="textfield3" type="text" id="textfield3" size="15" />- <input name="textfield4" type="text" id="textfield4" size="15" />- <input name="textfield5" type="text" id="textfield5" size="15" /> <input type="submit" name="button" id="button" value="提交" /> </form> </body> </html> <?php if(isset($_POST['button'])){ echo "排序后的數(shù)據(jù)如下所示:"; echo '<br/>'; $array=array( "0"=>$_POST['textfield'], "1"=>$_POST['textfield2'], "2"=>$_POST['textfield3'], "3"=>$_POST['textfield4'], "4"=>$_POST['textfield5'],);//把數(shù)字存到數(shù)組中 rsort($array); foreach($array as $key => $value){ echo $value;//循環(huán)輸出值 echo '<br/>'; } } ?>
感謝各位的閱讀!看完上述內(nèi)容,你們對(duì)php輸入幾個(gè)數(shù)從大到小排序的案例大概了解了嗎?希望文章內(nèi)容對(duì)大家有所幫助。如果想了解更多相關(guān)文章內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)網(wǎng)站制作公司行業(yè)資訊頻道。
網(wǎng)頁(yè)名稱:php輸入幾個(gè)數(shù)從大到小排序的案例-創(chuàng)新互聯(lián)
標(biāo)題來源:http://www.rwnh.cn/article8/dcogip.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供云服務(wù)器、企業(yè)建站、面包屑導(dǎo)航、網(wǎng)站制作、外貿(mào)網(wǎng)站建設(shè)、軟件開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容