The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 16, 2019, 05:09:59 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: if (PROXY == true) OR if (defined(PROXY))  (Read 2004 times)
nattsurfaren
Journeyman
***
Offline Offline

Posts: 64


View Profile
« on: September 28, 2008, 11:37:14 AM »

Using WAMP.
Changed
if (PROXY == true)
TO
if (defined('PROXY'))

After the change I could get curl to work.
Code picked up from YACG.
It seams that this is not the same thing.

I also noticed that you can write
if (defined(PROXY))

/Natt
« Last Edit: September 28, 2008, 11:41:22 AM by nattsurfaren » Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #1 on: September 28, 2008, 11:43:22 AM »

I don't know about the codebase for YACG, but I can tell you what's happening.

If PROXY == true looks to see if a defined constant is TRUE. Note the lack of a $ means that this is a defined constant.

defined(PROXY) will return T/F if the defined constant PROXY has been created at all. Bear in mind that if you did this:

define('PROXY', false);

the second example would still return true, because it's been defined - if (defined(PROXY)) does not evaluate the contents of PROXY, only it's existence.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nattsurfaren
Journeyman
***
Offline Offline

Posts: 64


View Profile
« Reply #2 on: September 28, 2008, 12:58:47 PM »

So I guess the correct logic would be?

if (defined(PROXY) && PROXY == true)
{

}
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #3 on: September 28, 2008, 04:34:54 PM »

Well, that would be thorough, but somewhat redundant - it would be assumed that *you* know what you've defined the variable as, but since it's not your code base, this would make sense. Try that and let us know.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!