PHP Array to JSON Array using json encode

0 votes

I have encoded an Array I've made using the inbuilt json_encode(); function. I need it in the format of an Array of Arrays like so:

[["Afghanistan",32,12],["Albania",32,12]]

 It is returning as:

{"2":["Afghanistan",32,12],"4":["Albania",32,12]}

How can I remove these row numbers without using any Regex trickery?

Jun 13, 2022 in PHP by narikkadan
• 63,600 points
662 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In PHP

0 votes
1 answer

How to delete element by value in array (not key) using php?

Hello @kartik, Using array_search() and unset, try the following: if (($key = ...READ MORE

answered Sep 16, 2020 in PHP by Niroj
• 82,840 points
2,056 views
0 votes
0 answers

How to reverse an array in php WITHOUT using the array reverse method

I have an array called reverse array ...READ MORE

Jun 12, 2022 in PHP by narikkadan
• 63,600 points
2,209 views
0 votes
0 answers

How to check whether an array is empty using PHP?

I have an array named players, what ...READ MORE

Jun 20, 2022 in PHP by Kithuzzz
• 38,000 points
456 views
0 votes
0 answers

PHP using extract() to pass array values as variables and display it on a page

In order to include a specific file ...READ MORE

Aug 6, 2022 in PHP by Kithuzzz
• 38,000 points
1,316 views
0 votes
1 answer

How to retrieve or obtain data from the MySQL database using PHP?

Hello kartik,  Actually there are many functions that  ...READ MORE

answered Mar 27, 2020 in PHP by Niroj
• 82,840 points
3,357 views
0 votes
1 answer

How to send email using php?

Hello @kartik 1.) Download PHPMailer, open the zip file ...READ MORE

answered Apr 1, 2020 in PHP by Niroj
• 82,840 points
1,363 views
0 votes
0 answers

json_decode to array

I want to decode a JSON string ...READ MORE

Jun 3, 2022 in PHP by Kichu
• 19,040 points
1,077 views
0 votes
0 answers

jQuery JSON Decode ( PHP to Javascript)

I'm trying to make an autocomplete script. ...READ MORE

Jul 1, 2022 in Web Development by gaurav
• 23,260 points
569 views
0 votes
1 answer

Cant get a specific value in JSON/PHP

Convert the json-string to a php-array and ...READ MORE

answered Sep 11, 2018 in Blockchain by slayer
• 29,370 points
2,866 views
0 votes
1 answer

jsonRPCClient Error with php variables

All you have to do is change ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 26,740 points
793 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP