Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
dvprog_11 [2020-02-10 11:16] Daniel Viström |
dvprog_11 [2020-05-07 13:26] Daniel Viström |
||
---|---|---|---|
Line 95: | Line 95: | ||
$y = 6; | $y = 6; | ||
// Variablerna behöver inte ha samma namn som i funktionen. | // Variablerna behöver inte ha samma namn som i funktionen. | ||
- | $sum = summa($x, $y) . '< | + | $sum = summa($x, $y); |
echo $sum . '< | echo $sum . '< | ||
Line 122: | Line 122: | ||
- | ==== Exempel | + | ==== Exempel |
Funktionen har i detta exempel lagts i en separat fil som heter ' | Funktionen har i detta exempel lagts i en separat fil som heter ' | ||
Line 132: | Line 132: | ||
*/ | */ | ||
function array_first($arr){ | function array_first($arr){ | ||
- | $answer = "" | + | $answer = '' |
$i = 0; | $i = 0; | ||
while($i < count($arr)){ | while($i < count($arr)){ | ||
Line 142: | Line 142: | ||
</ | </ | ||
- | Huvudprogram | + | Huvudprogram. |
<code php> | <code php> |