
Laurent_R
Veteran
/ Moderator
Dec 4, 2012, 2:38 PM
Post #6 of 6
(2989 views)
|
Re: [cyberfarer] Sorting Hash Values
[In reply to]
|
Can't Post
|
|
By far, the main role of the curly braces is to create a block of code that runs usually together and whose execution is determined by some specific condition, such as an "if" conditional or a "while" or a "foreach" loop. You generally want to have all the instructions within the curlies to execute together, depending on whether the condition is true or not. There are some other reasons to group pieces of code together in a block enclosed within curlies, but this is a slightly more advanced topic, remember for the time being that if you write:
if ($some_condition) { instruction 1; instruction 2; instruction 3; } this means that you want all three instructions to be executed if $some_condition evaluates to true, and none of them if $some_condition is false. Whatever comes after the closing curly is no longer dependent on $some_condition.
|