Re: note 90897 deleted from function.eval by thiago
| From: | Daniel Brown | Date: | Fri, 15 May 2009 12:37:16 +0000 |
| Subject: | Re: note 90897 deleted from function.eval by thiago | ||
| References: | 1 2 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154634@lists.php.net to get a copy of this message | ||
What was the reason for deleting this one? I don't see anything
obviously wrong, but it could just be me.
On Fri, May 15, 2009 at 07:58, <thiago@php.net> wrote:
> Note Submitter: chrisdone at gmail dot com
>
> ----
>
> You can use it to embed arbitrary embeded languages or "macros":
>
> <?php
> $id = 10;
>
> // SQL
> ob_start(); ?>
>
> SELECT * FROM users WHERE parentid > $id
> AND name LIKE '%s%'
>
> <?php $f=ob_get_contents();ob_end_clean();$sql=eval('return ("'
> .$f.'");');
>
> echo $sql;
>
> ?>
>
> Outputs:
>
> SELECT * FROM users WHERE parentid > 10 AND name LIKE '%s%'
>
> --
> PHP Notes Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
</Daniel P. Brown>
daniel.brown@parasane.net || danbrown@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW10000