Re: Expand variable in comparison

From: Date: Sat, 19 Jan 2008 17:52:19 +0000
Subject: Re: Expand variable in comparison
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-267648@lists.php.net to get a copy of this message
You can cheat like this: define('DEBUG', 1); if (DEBUG || $this->var == $preDefinedStringToTestWith) return true; else return false; At some later date, you change the 1 to 0 in the define() statement. Please tell us WHY you want do what you want to do... On Fri, January 18, 2008 1:50 pm, Marcus wrote: > Hi! > > > Is there any way to get the following snippet returning a true? > > > ... > $this->var = ????? > if ($this->var == $preDefinedStringToTestWith) > return true; > else > false; > > > > The problem: > I don't know, what $preDefinedStringToTestWith is! > $this->var can be set to any string. > > I tried > $this->var = "${preDefinedStringToTestWith}" > but this doesn't get expanded. > > > Thanks for your help, > > Marcus. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So?

« previous php.general (#267648) next »