1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Rep Power
    Does anyone know how I can use a function within eval()? The situation is this: I am retrieving a string from a database like

    '<P>HELLO <A HREF="www.xxx.com/$user/test.htm" </A></P>'

    The data held in the database for the user must be mixed case, but I want to create the link all in lower case. Currently I do

    echo "$code";

    But this returns 'hello' with the link in lower case. What I really want to do is store the strtolower() function in the database and have it used by eval() to return the text in upper case and the link in lower like :

    '<P>HELLO <A HREF="www.xxx.com/strtolower($user)/test.htm" </A></P>'

    but all that happens is that eval() ignores the strtolower function.

    Any ideas please?
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Rep Power
    You want the result of the following instruction:

    echo "<P><A HREF="www.xxx.com/".strtolower($user)."/test.html">HELLO</A></P>";

    just tell it to eval:

    $str='echo "<P><A HREF="www.xxx.com/".strtolower($user)."/test.html">HELLO</A></P>";'


    The string passed to eval must be valid PHP code. ( /strtolower($user)/ is not a valid construct ). Then, you can store the above string into your DB ( with the strtolower ).



Similar Threads

  1. A EVAL() Parse Error when using SSL
    By mediaworks in forum PHP Development
    Replies: 5
    Last Post: November 22nd, 2003, 09:55 AM
  2. Eval on MX
    By iissa69 in forum Flash Help
    Replies: 1
    Last Post: August 24th, 2003, 05:21 PM

IMN logo majestic logo threadwatch logo seochat tools logo