jonem Posted January 21, 2009 Share Posted January 21, 2009 Hi, I have problem with the eval() function and could use som help. I wish to have functions in an actual .php file but then I want to call this function from either code stored in a variable or in MySQL (I guess its about the same?) I have tried with this but cant get it to work. ---- $vpage='fAVINPicture(\'pics/\', \'bild2.jpg\', \'This is a picure of a giraff\', \'\', \'\', $WapVersion);'; echo $vtest = eval($vpage); ---- $vpage is where I intend to store the code I want executed and then I try to get it executed below. the function fAVINPicture() creates HTML code to show a picture depending on the variables sent to it. Please help! :-) Best regards -Jon Quote Link to comment https://forums.phpfreaks.com/topic/141751-solved-eval-how-do-one-use-it/ Share on other sites More sharing options...
Adam Posted January 21, 2009 Share Posted January 21, 2009 Try.. $vtest = eval($vpage); echo $vtest; Are there any errors returned from the eval() function? Adam Quote Link to comment https://forums.phpfreaks.com/topic/141751-solved-eval-how-do-one-use-it/#findComment-742061 Share on other sites More sharing options...
sasa Posted January 21, 2009 Share Posted January 21, 2009 try $vpage='$vtest = fAVINPicture(\'pics/\', \'bild2.jpg\', \'This is a picure of a giraff\', \'\', \'\', $WapVersion);'; eval($vpage); echo $vtest; Quote Link to comment https://forums.phpfreaks.com/topic/141751-solved-eval-how-do-one-use-it/#findComment-742152 Share on other sites More sharing options...
jonem Posted January 21, 2009 Author Share Posted January 21, 2009 MANY MANY thanks sasa I spend an enormous amount of time understanding the syntax. Again, many thanks /jon Quote Link to comment https://forums.phpfreaks.com/topic/141751-solved-eval-how-do-one-use-it/#findComment-742306 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.