#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Brisbane, Australia
    Posts
    1
    Rep Power
    0
    hi,

    my problem is with eval.
    I have in a "parse_me.html" file, a mix of HTML & PHP3. The PHP3 code in the "parse_me.html" file is very basic.

    Using my 'application', I read through the "parse_me.html" file copying the HTML line for line, and when it hits PHP3 code it is suppossed to process the code, using the eval() statement.

    e.g. sample from "parse_me.html"


    <head>
    <body>

    <? if ($value == $today)
    echo "HELLO WORLD; ?>

    </body>


    ...so when my application processes this file, the line with the PHP3 code is stored
    in $complete_code

    $complete_code = 'if ($value == $today) echo "HELLO WORLD";';
    eval ("$new_str = "$complete_code";");

    the data stored in $new_str is:
    if (1 == 0) echo "HELLO WORLD";

    instead of "HELLO WORLD".

    does anybody have any way of resolving this problem.

    many thanks in advance,
    alan
    http://www.ireckon.com
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Ontario, Canada
    Posts
    498
    Rep Power
    18
    You can't store commands in strings... so, you'll have to find another way to do what you're trying to do. Also, what is it that you are trying to do? All the eval() does is set the contents of $complete_code (with the current strings parsed) into $new_str. Perhaps you need to escape your variable assessment. I'm not sure I am helping much here, but it's worth a shot.

    ------------------
    To alcohol! The cause of, and solution to, all of life's problems. -- Homer Simpson

Similar Threads

  1. UTF-8 problem in 4.1.1a
    By mehran20 in forum MySQL Help
    Replies: 1
    Last Post: February 8th, 2004, 03:21 PM
  2. eval() detecting syntax errors
    By juhasev in forum PHP Development
    Replies: 2
    Last Post: February 5th, 2004, 04:32 PM
  3. fread problem: doesn t compile php code
    By ghorghor2002 in forum PHP Development
    Replies: 2
    Last Post: February 3rd, 2004, 06:25 AM
  4. Wierd problem inserting data with VB6
    By gregquinn in forum MySQL Help
    Replies: 5
    Last Post: February 2nd, 2004, 08:37 AM
  5. weird java problem..please help
    By suwandy in forum Java Help
    Replies: 1
    Last Post: January 26th, 2004, 05:13 AM

IMN logo majestic logo threadwatch logo seochat tools logo