Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Różnica zapisie warunku if()
kari
post
Post #1





Grupa: Zarejestrowani
Postów: 52
Pomógł: 0
Dołączył: 1.03.2005

Ostrzeżenie: (0%)
-----


Mam takie pytanie. Jaka jest różnica w takim zapytaniu:
  1. if () {
  2. echo 'wiadomość';
  3. }

a takim:
  1. if () echo 'wiadomość';
?
Czy ta druga wersja jest poprawna?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




Przecież masz to w manualu opisane :/
http://pl2.php.net/manual/en/control-structures.if.php
Cytat
Often you'd want to have more than one statement to be executed conditionally. Of course, there's no need to wrap each statement with an if clause. Instead, you can group several statements into a statement group. For example, this code would display a is bigger than b if $a is bigger than $b, and would then assign the value of $a into $b:
<?php
if ($a > $b) {
echo "a is bigger than b";
$b = $a;
}
?>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 6.10.2025 - 22:34