Opgelost
oplossing: Je mag ^ in php niet gebruiken voor macten.
Heej one2xsertjes,
Ik heb een klein probleempje met mijn php script. Dit is het script:
En dit geeft hij weer
Wie ziet de fout?
Alvast bedankt.
oplossing: Je mag ^ in php niet gebruiken voor macten.
Heej one2xsertjes,
Ik heb een klein probleempje met mijn php script. Dit is het script:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row1[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]x[/COLOR][COLOR= #007700]] >[/COLOR] [COLOR= #0000BB]$row2[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]x[/COLOR][COLOR= #007700]])
{[/COLOR]
[COLOR= #0000BB]$a[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row1[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]x[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$b[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row2[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]x[/COLOR][COLOR= #007700]];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[COLOR= #0000BB]$a[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row2[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]x[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$b[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row1[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]x[/COLOR][COLOR= #007700]];
}[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row1[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]y[/COLOR][COLOR= #007700]] >[/COLOR] [COLOR= #0000BB]$row2[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]y[/COLOR][COLOR= #007700]])
{[/COLOR]
[COLOR= #0000BB]$c[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row1[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]y[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$d[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row2[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]y[/COLOR][COLOR= #007700]];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[COLOR= #0000BB]$c[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row2[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]y[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$d[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$row1[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]y[/COLOR][COLOR= #007700]];
}[/COLOR]
[COLOR= #0000BB]$stap1[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$a[/COLOR] [COLOR= #007700]-[/COLOR] [COLOR= #0000BB]$b[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$stap1b[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$c[/COLOR] [COLOR= #007700]-[/COLOR] [COLOR= #0000BB]$d[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$twee[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]2[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$stap2[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$stap1[/COLOR] [COLOR= #007700]^[/COLOR] [COLOR= #0000BB]$twee[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$stap2b[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$stap1b[/COLOR] [COLOR= #007700]^[/COLOR] [COLOR= #0000BB]$twee[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$stap3[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$stap2[/COLOR] [COLOR= #007700]+[/COLOR] [COLOR= #0000BB]$stap2b[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$afstand[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/sqrt"]sqrt[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$stap3[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]$Aftsand:[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$afstand[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]$stap3[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$stap3[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]$a[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$a[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]$b[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$b[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]$c[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$c[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]$d[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$d[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]$a - $b[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$stap1[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]$c - $d[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$stap1b[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]$stap1 ^ 2[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$stap2[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]$stap1b ^ 2[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$stap2b[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]$stap2 + $stap2b[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$stap3[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br>[/COLOR][COLOR= #007700];[/COLOR]
?> En dit geeft hij weer
$Aftsand:
2.64575131106
$stap3
7
$a
10
$b
3
$c
2
$d
2
$a - $b
7
$c - $d
0
$stap1 ^ 2
5
$stap1b ^ 2
2
$stap2 + $stap2b
7 Wie ziet de fout?
Alvast bedankt.