Sep 2

In PHP we can use function eval in order to evaluate given variable (string) as PHP code:

<? 
$var = 'for ($i=0;$i<5;$i++)
{
	echo $i.\'<br>\';
}';
eval($var);
?>

output:

0
1
2
3
4

3 comments so far...

  • alarroste Said on February 19th, 2009 at 6:34 am:

    Hello webmaster,
    I would like to share with you a link, write to alarroste@mail.ru

  • Alexwebmaster Said on March 3rd, 2009 at 3:57 pm:

    Hello webmaster
    I would like to share with you a link to your site
    write me here preonrelt@mail.ru

  • KonstantinMiller Said on July 7th, 2009 at 1:18 am:

    Hello. I think the article is really interesting. I am even interested in reading more. How soon will you update your blog?

leave a reply