/    Sign up×
Community /Pin to ProfileBookmark

newbie question

Hey, I am learning PHP, and I understand it so far…but..lol…What does the ‘{‘ stand for in the code?

Is it like a selector?

[CODE]
<?php

if ($numTries > 10) {
$msg = ‘Blocking your account…’;
}
else {
$msg = ‘Welcome!’;
}

?>
[/CODE]

And more complex, nested:

[CODE]
<?php

if ($day == ‘Thursday’) {
if ($time == ‘0800’) {
if ($country == ‘UK’) {
$meal = ‘bacon and eggs’;
}
}
}

?>
[/CODE]

Man, I am loving PHP!

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@chazzyFeb 13.2006 — its typical of any programming language. it just encapsulates your code -

if ( condition ){

//then do what's in here

}

else{

//do this

}
Copy linkTweet thisAlerts:
@codym43authorFeb 13.2006 — So, just like CSS:

<i>
</i>
#blah {
stuff
}

Copy linkTweet thisAlerts:
@welshFeb 13.2006 — pretty much.
×

Success!

Help @codym43 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...