[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

PHP:  how to execute a string as a line of PHP code

Posted on 2008-01-27
2
Medium Priority
?
270 Views
Last Modified: 2010-04-21
Example:  
$CodeString = "$A = 1";

How can i "execute"     $CodeString     by calling some function with it as a parameter?

Note:  This is NOT a shell command, just simple PHP code.
0
Comment
Question by:willsherwood
2 Comments
 
LVL 82

Accepted Solution

by:
hielo earned 2000 total points
ID: 20756658
eval($CodeString);

http://us2.php.net/eval
0
 

Author Closing Comment

by:willsherwood
ID: 31425539
thanks!
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

608 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question