RE: [PHP] Expand variable in comparison
| From: | Andrés Robinet | Date: | Fri, 18 Jan 2008 23:09:11 +0000 |
| Subject: | RE: [PHP] Expand variable in comparison | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-267606@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: news [mailto:news@ger.gmane.org] On Behalf Of Marcus
> Sent: Friday, January 18, 2008 4:51 PM
> To: php-general@lists.php.net
> Subject: [PHP] Expand variable in comparison
>
> 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.
>
> --
Uh! Shouldn't it work?
$this->var = $preDefinedStringToTestWith
Rob