Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9170543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:02:18+00:00 2026-06-17T16:02:18+00:00

Is it possible to have just normal php code and not use eval() function

  • 0

Is it possible to have just normal php code and not use eval() function in such case?

My eval code is following:

eval('$'.$var.'["'.$key.'"]="'.$value.'";');

And what I am doing is following:

function config_update($array, $var="result")
{ 
    global $result, $dbi;

    while (list($key,$value)=each($array))
    {
        if (is_array($value))
        { 
            config_update($value, $var.'["'.$key.'"]'); 
        } 
        else
        { 
            for ($i=0; $i<count($value);$i++)
            {
                if ($value == "{FROM_DB}")
                {
                    $query = $dbi->prepare("SELECT `value` FROM `".PRE."config` WHERE `key`=?;")->execute($key)->results();

                    if (!$query) 
                    {
                        trigger_error("There is no such key as `{$key}` in config database",E_USER_ERROR);
                        exit;
                    }
                    else
                        $value = str_replace("{FROM_DB}",$query[0]['value'],$value);
                }
                eval('$'.$var.'["'.$key.'"]="'.$value.'";');
                //$$var[$key] = $value; #smth like that..
            }
        }
    }
}

I basically need to update variable values with {FROM_DB} with values coming from DB.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:02:19+00:00Added an answer on June 17, 2026 at 4:02 pm

    from the php manual on variable variables you should use {} when working with array based variable variables to avoid unknown behavior.

    ${$var}[$key] = $value
    

    see Variable variables

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first time use JTree. Just wondering is it possible to have more than one
I have just heard that - push notification is possible in iPhone I need
Is this possible? I have a solution with both projects, I just want to
In C we have Sockets and descriptors, it is possible to just take one
Is it possible? From what I have heard it is. I wouldn't mind just
I don't know if the is even remotely possible, but just now I have
Hey, I'm just wondering if it's possible to have a form in html do
I am trying to make my code NOT to accept keyword arguments just like
My normal development platform for PHP is Linux. I use a Red hat server
Is it possible to have a secure piece of Javascript code in a web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.