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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:23:57+00:00 2026-05-23T02:23:57+00:00

I have a group of PHP array data like this: $xx_add = array( array(‘id’=>1,

  • 0

I have a group of PHP array data like this:

$xx_add = array(
    array('id'=>1, 'name'=>"jiahui shop", 'description' => "Jl. Sukarjo Wiryopranoto No. 69 A, Pasar Baru", 'lat'=>-6.249650, 'lng'=>106.850288),
    array('id'=>2, 'name'=>"Success United Pte Ltd", 'description' =>"Atrium Plaza Blok E Unit 122 5 Jl. Senen Raya No. 135 Senen, Jakarta Pusat", 'lat'=>-6.167170, 'lng'=>106.873894),
    array('id'=>3, 'name'=>"Chilis Restaurant, Lt. 2, Jl. MH. Thamrin No. 11, Sarinah", 'description' =>"Sarinah Building, Lt. 2, Jl. MH. Thamrin No. 11, Sarinah", 'lat'=>-6.197090, 'lng'=>106.738213)
); 

How can I do, so that I can get a bundle of javascript array as like shown below?

var $xx_add = [
    {'id': 1, 'name': 'jiahui shop', 'description': 'Jl. Sukarjo Wiryopranoto No. 69 A, Pasar Baru', 'lat': -6.249650, 'lng': 106.850288 }, 
    {'id': 2, 'name': 'Success United Pte Ltd', 'description': 'Atrium Plaza Blok E Unit 122 5 Jl. Senen Raya No. 135 Senen, Jakarta Pusat', 'lat': -6.167170, 'lng': 106.873894 }, 
    {'id': 3, 'name': 'Chilis Restaurant', 'description': 'Sarinah Building, Lt. 2, Jl. MH. Thamrin No. 11, Sarinah', 'lat': -6.197090, 'lng': 106.738213 }
];

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-05-23T02:23:58+00:00Added an answer on May 23, 2026 at 2:23 am

    You can also embed PHP in your JavaScript block (which is the most ugly solution I can think of):

    <?php
        $xx_add = array(...);
    ?>
    
    <script>
        var xx_add = <?php json_encode($xx_add); ?>
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table with data exactly like this: ID Heading Description Time Location
Hello I have an array that looks like this after passing it through uksort()
I have two PHP arrays. One contains a group name and another contains a
I have group of stored procedures with names like 'somename_%'. Are there any way
I have a group of buttons that should act like toggle buttons, but also
Hello I currently have this PHP Script <?php if($purchase_dates != FALSE){?> <?php foreach($purchase_dates as
I have installed the Net_Geo pear package on my PHP Server. This is the
I have pairs of items in an PHP array. Example: <?php $elements = array(
Asking this question here because in CakePHP google group got no answer.I have the
So. I have a table of data, in a MySQL database, eg: Artist Name

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.