jd2007 Posted November 20, 2007 Share Posted November 20, 2007 how do i convert this string: "print('hello')" to act like this: <?php print('hello'); ?> Link to comment https://forums.phpfreaks.com/topic/78028-how-do-i-treat-a-string-as-a-code-to-be-executed-eg-below/ Share on other sites More sharing options...
~n[EO]n~ Posted November 20, 2007 Share Posted November 20, 2007 <?php print "print('hello')"; ?> another <?php print "\"print('hello')\""; ?> Link to comment https://forums.phpfreaks.com/topic/78028-how-do-i-treat-a-string-as-a-code-to-be-executed-eg-below/#findComment-394914 Share on other sites More sharing options...
teng84 Posted November 20, 2007 Share Posted November 20, 2007 fumction printHello() { print 'hello'; } printHello(); Link to comment https://forums.phpfreaks.com/topic/78028-how-do-i-treat-a-string-as-a-code-to-be-executed-eg-below/#findComment-394916 Share on other sites More sharing options...
jd2007 Posted November 20, 2007 Author Share Posted November 20, 2007 no...is there a way to make a string act like code like the Javascript function eval() ? Link to comment https://forums.phpfreaks.com/topic/78028-how-do-i-treat-a-string-as-a-code-to-be-executed-eg-below/#findComment-394918 Share on other sites More sharing options...
teng84 Posted November 20, 2007 Share Posted November 20, 2007 php also has eval http://www.php.net/manual/en/function.eval.php Link to comment https://forums.phpfreaks.com/topic/78028-how-do-i-treat-a-string-as-a-code-to-be-executed-eg-below/#findComment-394921 Share on other sites More sharing options...
jd2007 Posted November 20, 2007 Author Share Posted November 20, 2007 yeah...i just noticed in the manual...thanks Link to comment https://forums.phpfreaks.com/topic/78028-how-do-i-treat-a-string-as-a-code-to-be-executed-eg-below/#findComment-394922 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.