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

  • SEARCH
  • Home
  • 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 657635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:50:45+00:00 2026-05-13T22:50:45+00:00

I want to generate the array $result_array. There is no error at the page,

  • 0

I want to generate the array $result_array. There is no error at the page, but not works!

that not works !

//BOF: Result Array
 $result_array = '';
 $result_array .= '"messages" => "' . $errors .'",';
 $result_array .= '"this_addr_type" => "' . (int)$_REQUEST['edit'] .'",';
if (ACCOUNT_GENDER == 'true') {
 $result_array .= '"gender_male" => "' . $male .'",';
 $result_array .= '"gender_female" => "' . $female .'",';
}
 $result_array .= '"firstname" => "' . $entry['entry_firstname'] .'",';
 $result_array .= '"lastname" => "' . $entry['entry_lastname'] .'",';
if (ACCOUNT_COMPANY == 'true') {
 $result_array .= '"company" => "' . $entry['entry_company'] .'",';
}
 $result_array .= '"street_address" => "' . $entry['entry_street_address'] .'",';
if (ACCOUNT_SUBURB == 'true') {
 $result_array .= '"suburb" => "' . $entry['entry_suburb'] .'",';
}
 $result_array .= '"postcode" => "' . $entry['entry_postcode'] .'",';
 $result_array .= '"city" => "' . $entry['entry_city'] .'",';
if (ACCOUNT_STATE == 'true') {
 $result_array .= '"state" => "' . $entry['entry_state'] .'",';
}
 $result_array .= '"country" => "' . $entry['entry_country_id'] .'"';
//EOF: Result Array

  $_RESULT = array($result_array);

that works

$_RESULT = array(
 "this_addr_type" => (int)$_REQUEST['edit'],
 "gender_male" => $male,
 "gender_female" => $female,
 "firstname" => $entry["entry_firstname"],
 "lastname" => $entry["entry_lastname"],
 "company" => $entry["entry_company"],
 "street_address" => $entry["entry_street_address"],
 "suburb" => $entry["entry_suburb"],
 "postcode" => $entry["entry_postcode"],
 "city" => $entry["entry_city"],
 "state" => $entry["entry_state"],
 "country" => $entry["entry_country_id"]
);
  • 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-05-13T22:50:45+00:00Added an answer on May 13, 2026 at 10:50 pm

    Because you’re trying to get PHP to treat a string as code. My question would be “why” – but if you MUST do it, you’re looking for eval : http://php.net/manual/en/function.eval.php

    // untested
    $_RESULT = eval("return " . "array($result_array)" . ";");
    

    Will probably give you the result you’re loking for.

    The real qusetion is why aren’t you just doing this:

    if (ACCOUNT_GENDER == 'true') {
     $result_array['gender_male'] = $male;
     $result_array['gender_female'] = $female;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to generate random integers between 0-9 (inclusive on both ends), but I
I have an array of empty cells and ones that I want to convert
Given an array of size n I want to generate random probabilities for each
I wish to test a function that will generate lorem ipsum text, but it
I want to build advanced search script but I have this error with search_all
I want to generate an url like this: /photo?tags=tag1,tag2,tag3 routes file: GET /photo controllers.Photos.list(tags:Array[String]
Let's say I have a class of 30 students and want generate every possible
I want to generate a list of files where the name consists of ${filename}.${date}
I want to generate a random timestamp and add a random increment to it
I want to generate an HTML table from a couple specified parameters. Specifically, the

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.