Session Score


Membership


Navigate
Current Topic:
View Topic Tree
Everything > Science & Technology > Computers > Programming > PHP

In the PHP programming language, which of the following types of brackets is used to designate the start and end of a block of statements to be executed after an if, a for, or a while statement?
correct answer { ... }
correct answer [ ... ]
correct answer < ... >
correct answer ( ... )
Next Question

Explanation

In the PHP programming language, curly brackets { ... } are used to designate the start and end of a block of statements to be executed after an if, a for, or a while statement. This is exactly the same as is used in the programming languages C and C++.

For example, the following code will increment the variable $y four times if $x is a positive number (greater than zero):

if ($x > 0)

{
$y++;
$y++;
$y++;
$y++;
}


Since, in PHP, linebreaks are not important, the above code is exactly identical to the following code:

if ($x > 0) { $y++; $y++; $y++; $y++; }



Please rate this question and explanation .... ( takes you to the next question >>> )
Excellent Good Bad Terrible

Info
Admin Functions