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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:19:49+00:00 2026-06-16T19:19:49+00:00

I have an array in php, with print_r it looks like this Array (

  • 0

I have an array in php, with print_r it looks like this

Array ( 
    [0] => Array ( [0] => 2 [1] => 3 [2] => 3 [3] => 1 [4] => 1 [5] => 4 [6] => 1 ) 
    [1] => Array ( [0] => 1 [1] => 2 [2] => 2 [3] => 1 [4] => 1 [5] => 1 [6] => 1 ) 
) 

when I do json_encode($mydata) it looks like this

[["2","3","3","1","1","4","1"],["1","2","2","1","1","1","1"]]

but I need this without the quotes, as the next processing simply needs a dataset like this:

var dataset = [ 5, 10, 15, 20, 25 ];

the dataset was never intended to use json standards, I simply need to get my array formatted correctly.

so the question is either “how do I remove quotes from json” which is simply nonstandard invalid json and won’t get me the responses I’d need

OR

“how do I format this php array to be like the dataset”.

it either involves a different kind of print function in php, or it involves some forloop regex in javascript

  • 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-16T19:19:51+00:00Added an answer on June 16, 2026 at 7:19 pm

    Ehhh you could try this:

    $d = array();
    foreach($myData as $data) {
        $d[] = "[" . implode(",", $data) . "]";
    }
    echo "[" . implode(",", $d) . "]";
    

    Demo: http://codepad.org/nTveAGWm

    Although echoing out json_encode($myData); worked as well: http://codepad.org/KTfQHz6s

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

Sidebar

Related Questions

i have an array in php like this: $arr['test'] = asd; $arr['test1'] = asd1;
Say I have an array in PHP that looks like so: $values = Array(
All, I have some PHP PDO code that looks like this: <?php ... $query=$dbh->prepare(SELECT
I have a PHP script that parses an array using the json_encode() method but
I have an array $attribGarden which looks like this: array(3) { [0]=> array(2) {
I have an array that looks like this: Array ( [TIMESTAMP] => 2012-01-04T21:36:32Z [CORRELATIONID]
I have created an array in php that prints this Array ( [mark] =>
I have this array in PHP: array( [0] => array( 'username' => 'user1' )
I have an Array like below in PHP array( (int) 0 => array( 'id'
I have some xml that looks like this: <?xml version=1.0?> <data> <items> <item><timestamp>2011-07-11T09:01:42Z</timestamp><title><![CDATA[ some

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.