Függvényhívások
Függvényhívások esetében ne használjunk szóközt a függvény neve,
a nyitó zárójel és az első paraméter között. Ugyanakkor használjunk
szóközt a vessző és minden azt követő paraméter között. Ne
használjunk szóközt az utolsó paraméter, a záró zárójel és a
pontosvessző között. Például:
<?php
$var = foo($bar, $baz, $quux);
?>
Ahogy a fenti példában is látszik, hagyjunk 1-1 szóközt az egyenlőségjel
mindkét oldalán, amikor egy függvény visszatérési értékét adjuk
értékül egy változónak. Egy olyan blokkban, ahol egymást követően
több értékadást végzünk, több szóközt szúrhatunk be az olvashatóság
elősegítése érdekében:
<?php
$rovid = foo($bar);
$hosszu_valtozo = foo($baz);
?>
Vezérlőszerkezetek (Previous)
|
(Next) Függvénydefiníciók
|
|
|
Download Documentation
|
Last updated: Sun, 18 Oct 2009 |
|
Do you think that something on this page is wrong? Please file a bug report or add a note.
|
| User Notes: |
Note by: masiena@hotmail.com
"In a well written code you shouldn't use find/replace. Especially a mindless find/replace. If so take your time. "
Sure?
If you ALREADY have bad code, you will do find/replace. If you refactor code, you will do find/replace. If you don't like your predecessor's coding style in the project at hand, you will do find/replace.
In all that cases (and other, I suppose), extra spaces just get in the way. By the way, find/replace that uses REs get complicated by extra spaces.
Just some thoughts of someone that has been in the battle field. For the last 25 years.
Cheers.
Note by: user@example.com
In a well written code you shouldn't use find/replace. Especially a mindless find/replace. If so take your time.
Note by: aheinz@lulu.com
Adding spaces for horizonal justification improves readability until you do a search/replace on a variable name. This practice should be discouraged.
|
|