Post subject: How do I write this in PHP?
Joined: 12/26/2006
Posts: 256
Location: United States of America
"If x is not greater than or equal to 943.15." In C/C++ it would look like this...
if ( !(x >= 943.15) )
I want the exact logical equivilant in PHP. I don't want it reworded to "if x is less than 943.15" because that's not what I'm trying to program. If you're curious as to what this is for or why 943.15 is such a special number, I'll tell you later. ; )
Emulator Coder, Site Developer, Former player
Joined: 11/6/2004
Posts: 833
Variables in PHP are prefixed by a $. So if (!($x >= 943.15)) should do it nicely. As for logic, it shouldn't make a funcional difference. Depending on the presence of an optimizer, the code which does fewer operations might be faster.
Joined: 12/26/2006
Posts: 256
Location: United States of America
Thanks. I'll post back here for what this was for, which has nothing to do with logic.
Former player
Joined: 10/1/2006
Posts: 1102
Location: boot_camp
Wouldn't a simpler C/C++ code be:
if (x < 943.15)
Sorry if this post doesn't help, but I just want to point out some redundancies. EDIT: my bad, didn't read the whole post.
Borg Collective wrote:
Negotiation is irrelevant. Self-determination is irrelevant. You will be assimilated.
Former player
Joined: 1/17/2006
Posts: 775
Location: Deign
Deep Loner wrote:
I want the exact logical equivilant in PHP. I don't want it reworded to "if x is less than 943.15" because that's not what I'm trying to program.
Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign aqfaq Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign Deign
Joined: 10/24/2005
Posts: 1080
Location: San Jose
laughing_gas wrote:
Wouldn't a simpler C/C++ code be:
if x < 943.15
Sorry if this post doesn't help, but I just want to point out some redundancies.
Holy syntax errors sherlock! You need the parenthesis, unless you are using some funky c standards.
<agill> banana banana banana terracotta pie! <Shinryuu> ho-la terracotta barba-ra anal-o~
Joined: 12/26/2006
Posts: 256
Location: United States of America
Everyone hold your horses until I tell you why I started this thread in the first place, OK?
Joined: 10/24/2005
Posts: 1080
Location: San Jose
Deep Loner wrote:
Everyone hold your horses until I tell you why I started this thread in the first place, OK?
Are you missing the "<" sign on your keyboard?
<agill> banana banana banana terracotta pie! <Shinryuu> ho-la terracotta barba-ra anal-o~
Joined: 12/26/2006
Posts: 256
Location: United States of America
DK64_MASTER wrote:
Are you missing the "<" sign on your keyboard?
You're going to find a way to be a wise guy, aren't you? ; ) No, I'm actually trying to post a commentary of the code found here. Try using the < key and see what happens. (edited to remove stupidity)
upthorn
He/Him
Emulator Coder, Active player (392)
Joined: 3/24/2006
Posts: 1802
Deep Loner wrote:
DK64_MASTER wrote:
Are you missing the "<" sign on your keyboard?
You're going to find a way to be a wise guy, aren't you? ; ) No, I'm actually trying to post a commentary of the code found here.
Yeah, I saw the same solution, but refrained from posting because I wasn't sure that ! means the same thing in PHP as it does in C++.
How fleeting are all human passions compared with the massive continuity of ducks.
Bp_
Joined: 11/30/2005
Posts: 81
Location: Quebec
DK64_MASTER wrote:
laughing_gas wrote:
Wouldn't a simpler C/C++ code be:
if x < 943.15
Sorry if this post doesn't help, but I just want to point out some redundancies.
Holy syntax errors sherlock! You need the parenthesis, unless you are using some funky c standards.
I dont use parenthesis in Foxpro :)