[php] Coderen

Gestart doorJankees11 reacties9 weergaven

12 berichten · pagina 1 van 1

Jankees

Lid · Topicstarter

Berichten
3
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hallo,

Ik wil php leren schrijven. Alleen zie ik in andere scripts allemaal van die spaties.
<html>
    <body>
        [COLOR= #0000BB]<?php[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Hallo wereld![/COLOR][COLOR= #007700];[/COLOR]
        ?>
    </body>
</html>


Tussen de kantlijn, en waar de code echt begint.
Hoe moet ik weten waar, en hoeveel spaties ik er neer moet zetten. Of gaat het allemaal automatisch.

Jan,
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Op zich maakt het niet uit hoeveel je er plaatst, PHP zet alle code toch achter elkaar als de code wordt uitgevoerd
0
Berichten
3.788
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Die spaties zijn meestal tabs, en maken voor het script niks uit.
Wel is het vaak overzichtelijker als je ze gebruikt, dit is meestel binnen IFs, zo kan je zien wat waaronder valt
0
Jankees

Lid · Topicstarter

Berichten
3
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Oke, bedankt smile
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ligt er maar net aan waarom je dat wilt. Welke van deze 2 vind jij overzichtelijker?

[COLOR= #0000BB]<?php
$naam[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]Milan[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]Milan[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$naam[/COLOR][COLOR= #007700];
}[/COLOR]
?>


of:

[COLOR= #0000BB]<?php

$naam[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]Milan[/COLOR][COLOR= #007700];[/COLOR]

[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]Milan[/COLOR][COLOR= #007700])
{[/COLOR]

    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$naam[/COLOR][COLOR= #007700];

}[/COLOR]
?>
0
Erik

Lid

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik vind dit netter:

[COLOR= #0000BB]<?php
$naam[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]Erik[/COLOR][COLOR= #007700];[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]Erik[/COLOR][COLOR= #007700])
{[/COLOR]
    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$naam[/COLOR][COLOR= #007700];

}[/COLOR]
?>
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Een enter maakt ook echt uit hé? yummie
E: @TS maar het is maar wat je zelf het fijnst vindt
0
Erik

Lid

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Er zit redelijk wat verschil in?
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Waar dat dan?
0
Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Inderdaad die van Erik vind ik beter. Alleen die spaties tussen de ifs vind ik ook onnodig.
0
Jankees

Lid · Topicstarter

Berichten
3
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Oke, nu kan ik verder gaan smile
Allemaal bedankt!
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Normaal gesproken is de indenting (de tab tussen 2 punten) rond de 4 spaties. Zo is ook de standaard van, correct me if im worng, pear.
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren