/    Sign up×
Community /Pin to ProfileBookmark

What doe sthis mean

$a = (“php”==”php”) ? “true”:”false”;

hi can you break this down into english please

i under stand == and $a but what i ? and :

thanks

to post a comment
PHP

9 Comments(s)

Copy linkTweet thisAlerts:
@pyroJul 08.2003 — In english:

If "php" equals "php" set $a to "true". If "php" (or rather, the first condition) does not equal "php" (the second condition) set $a to false.

Basically, it is a simplified if statement that would be equivalent to this:

[code=php]if ("php" == "php") {
$a = "true";
}
else {
$a = "false";
}[/code]
Copy linkTweet thisAlerts:
@andrew1234authorJul 08.2003 — thanks for th if statement

i understand that.

is it comman to use this shortened method?

andrew
Copy linkTweet thisAlerts:
@pyroJul 08.2003 — Not really -- at least not in PHP. It is more common in javascript. I think this is the first time I've seen it in PHP...
Copy linkTweet thisAlerts:
@andrew1234authorJul 08.2003 — dont you think that it is a bit silly of them to put it in a beginners php book.

anyway thanks for the help

Andrew
Copy linkTweet thisAlerts:
@pyroJul 08.2003 — It actually is good to know, as you can shorten certain bits of code considerably using it. But, as you said, it may be a bit premature in a beginners book...
Copy linkTweet thisAlerts:
@andrew1234authorJul 08.2003 — i checked out your site and it rocks..very nice design

I'm more of a flash html guy myself

i'd be interested what you think of this

http://www.hamandmushroom.co.za/test/andrew.swf

my action script is better than my php and java script

Andrew
Copy linkTweet thisAlerts:
@pyroJul 08.2003 — Thank you... ?

About your site...

That would make a better game than navigation system. Kinda hard to use, IMO. Also, all the pages that popped up gave a 404...
Copy linkTweet thisAlerts:
@andrew1234authorJul 09.2003 — and from a action script point of view?

what did you think?

Andrew
Copy linkTweet thisAlerts:
@pyroJul 09.2003 — I know very little action script, but it seemed to work well... ?
×

Success!

Help @andrew1234 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 6.2,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...