知識社群登入
【分享】PHP-將輸入的數字反序列出
by wen, 2010-12-25 23:17, 人氣(2457)
 
HTML
--------------------------
<h3 >設計一個程式,讀取若干個數值,並將資料一反順序列出。</h3>
請輸入數值:<input id="Text1" type="text" name ="va" />
<input id="Submit1" type="submit" value="執行" />
<input id="Reset1" type="reset" value="清除" />
PHP
---------------------------
<?
echo "反順序的數值:";
$str=$_REQUEST["va"];
 
$arr=split(',',$str);
 
$length=count($arr);
for($i=$length;$i>=0;$i--){
echo "$arr[$i] ,";
 }
?>