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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:36:11+00:00 2026-06-10T16:36:11+00:00

I have a more dimensional php array that i want to pass to a

  • 0

I have a more dimensional php array that i want to pass to a javascript array.

This is the array:

$this->_db_list_arrray[$this->getID()][$key] = $row;

its like “16”:[[{“article_no_internal”:”9987213″}]] and so on.
I encode it like this:

$shipping_part_list_array = json_encode($db_obj->getArticleList($elements));

and in javascript

alert("<?php  echo $shipping_part_list_array; ?>");

but the alert only shows [].

Is there a better way to pass php array to java script array?

array(1) {
  [16]=>
  array(2) {
    [0]=>
    array(1) {
      [0]=>
      array(2) {
        ["article_no_internal"]=>
        string(6) "999184"
        ["article_name_internal"]=>
        string(29) "Geschenkbox Kerzenschein 2011"
      }
    }
    [1]=>
    array(1) {
      [0]=>
      array(2) {
        ["article_no_internal"]=>
        string(6) "999184"
        ["article_name_internal"]=>
        string(29) "Geschenkbox Kerzenschein 2011"
      }
    }
  }
}

this is in my console, now i need to parse to get the right data. Thank you

  • 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-10T16:36:12+00:00Added an answer on June 10, 2026 at 4:36 pm

    You should not put double quotes around the JSON encoded value; just the following will do:

    alert(<?php echo $shipping_part_list_array; ?>);
    

    Though, for debugging purposes the following would be better:

    console.log(<?php echo $shipping_part_list_array; ?>);
    

    Lastly, to assign it to a JavaScript variable:

    var list = <?php echo $shipping_part_list_array; ?>;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an 2 dimensional array. Each of the row vectors, in this case,
I have a 2-dimensional array of objects (predominantly, but not exclusively strings) that I
I have been working on this a while. I see multi-dimensional arrays in php
I have a multi-dimensional array that I am trying to feed into difflib.get_close_matches() .
I have an app that shows store sales. It is a multi-dimensional array, so
I have a numpy one dimensional array c that is supposed to be filled
I have this php code: $lines = file(data.csv); $nested = array(); $links = array();
I have an 2 dimensional array that is full of 1s and 0s such
I have more than one Event Listener that calls a specific function, and I
i have more viewcontroller that start from rootviewcontroller. So for example i start with

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.