在PHP是有遞增後續值的PHP的陣列輸出問題
值的函數兩次基於初始值(* 2)以陣列
列?
$beta = array(
array('5', '1''1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'),
array('5','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2'),
array('5','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2'),
array('5','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2'),
array('5','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2'),
array('5','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2'),
array('5','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2'),
array('5','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2'),
array('5','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2'),
array('5','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2')
);
/*Example: '5' will be '10' (5*2 =10 and output 10 to web)
'2' will be '4' (2*2 = 4 and output 4 to web)
The next '2' will be '16' (4*2 = 8 and output 8 to web)
The next '2' will be '32' (8*2 = 16 and output 16 to web)
And so forth? */
而且有構造此陣更簡單的方法,因爲我堅信有,但不是在結構方面太複雜,使得小白不會理解它,再次感謝。
[免責聲明:我花了3天的時間來理解數組,我現在明白了;然而,我仍然是新手,目前在嘗試操作數組中的值並將其輸出到網絡時遇到了一些問題。而且我仍然確信我有很多需要閱讀和學習的內容,所以請不要使用flamers,我只是需要一些幫助,找到了這款C這個問題++的書:
您在第一個子數組中缺少逗號。 ;) – MitMaro 2009-11-16 12:25:11