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 8927647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:15:58+00:00 2026-06-15T08:15:58+00:00

I am working with a project that is coded in php OOP. I have

  • 0

I am working with a project that is coded in php OOP. I have created a form that post back to itself and gets those values and puts them into a predefined array format. I say predefined because this is the way the previous coder has done it:

$plane->add(array('{"name":"Chris","age":"22"}','{"name":"Joyce","age":"45"}'));

So when I get my values from the $_POST array, I thought it would be simple, so I tried

$plane->add(array("{'name':$customerName,'age':$customerAge}"));

This is triggering an error though, it seems it’s passing the actual name of the variable in as a string instead of it’s value. So how do I pass those values in to that function. While we are on it, can someone explain what kind of array that is, I thought arrays were always $key=>value set, not $key:$value.

  • 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-15T08:15:59+00:00Added an answer on June 15, 2026 at 8:15 am

    That looks like json:
    http://sandbox.onlinephpfunctions.com/code/e1f358d408a53a8133d3d2e5876ef46876dff8c6

    Code:

    $array = json_decode('{"name":"Chris","age":"22"}');
    print_r( $array );
    

    And you can convert an array to json with:

     $array = array("Customer" => "John");
     $arrayJson = json_encode( $array);
    

    So to put it in your context:

    $array = array("Name"=>"Chris", "age" => 22);
    $array2 = array("Name"=>"John", "age" => 26);
    $plane->add(array( json_encode( $array),json_encode( $array2) );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some PHP code in a project I'm working on that uses PHP's
I am currently working on a php project. I need to post two values,
I am currently working on a project where I have code that looks like
I have a working project that Im amending, it crashes after trying to use
I'm working in a project that need to get SVD (Single Values Decomposition) for
I am working in a PHP project that uses checkstyle to validate the code.
I am working on a project that pulls data from JMS queue using PHP
I'm working on an iPhone project that needs to receive data from a PHP
I'm working on a project that involves a database (My SQL), website (PHP) and
So I'm working on a PHP project that needs to allow the user to

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.