Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16:
| $s = array(); $d = array(); $s[0]=1; $d[0]=1;
function FillArray($count) { if ($count > 1) { $i = 0; echo $s[0]; while ($i <= $count) { $s[$i+1] = $s[$i] + $d[$i]; $d[i+1] = $d[$i] + (2 * $s[i]); $i++; } } } |
Warum ist $s[0] hier auf einmal leer?

Ist das Array in der function unbekannt? Wie kann man das Problem lösen, da nichts ausgegeben wird. In meinen PHP-Buch wird die globals-Anweisng erwähnt, aber wie kann man die bei einem Array anwenden?
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot