我想用PHP打印3個字符的模式。像aaa,aab,aac .... zzz。3個字符的打印模式序列
現在,我正在使用這些PHP代碼,但它是隨機打印順序。
$i = 1;
$chars = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
while($i > 0){ $current = $chars[rand(0,25)].$chars[rand(0,25)].$chars[rand(0,25)]; }
解析錯誤:語法錯誤,意外的'[',期待','或';'在第12行的C:\ xampp \ htdocs \ start \ test2.php – Rinku 2014-11-08 10:45:04
但是當我替換「echo chars [$ i] .chars [$ j] .chars [$ k];」用「echo」hi
「;」然後打印嗨。 – Rinku 2014-11-08 10:51:56
@RinkuYadav ok試試看,看看是否可以解決任何問題: echo「chars [$ i] chars [$ j] chars [$ k]
」; – 2014-11-08 10:54:26