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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:07:14+00:00 2026-05-24T01:07:14+00:00

Do functions that print arrays all use the same notation to do so? What

  • 0

Do functions that print arrays all use the same notation to do so? What is the reasoning for one notation over another? I noticed when using PHP print_r to display an array compiled using mysql_fetch_array, the notation of the array is as follows:

Array ([column] => value [index] = value)

For example, if this is the table:

id fname lname
1 John Smith

Then the print_r output of mysql_fetch_array will be:

Array ([id] => 1 [0] => 1 [fname] => John [1] => John [lname] => Smith [2] => Smith)

What is the reason for this notation? Specifically, why does the value repeat? Isn’t that redundant?

Also, can anybody recommend a good resource for a better conceptual understanding of arrays in general? Thanks!

  • 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-24T01:07:15+00:00Added an answer on May 24, 2026 at 1:07 am

    Associative arrays use strings for the index, numeric arrays use numbers.

    mysql_fetch_array() creates an associative array containing numeric keys as well so that both may be used to access the array.

    mysql_fetch_assoc() creates an array containing only the string indices.

    mysql_fetch_row() creates an entirely numeric array, and is the fastest to execute of these functions.

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

Sidebar

Related Questions

Using VBA i have a set of functions that return an ADODB.Recordset where all
I have several functions that I wrote and I use regularly on my servers,
I mostly use lambda functions but sometimes use nested functions that seem to provide
I'm trying to dynamically define functions that call through to another function that takes
I'm implementing unit tests for a family of functions that all share a number
I have a function that is effectively a replacement for print, and I want
ReSharper likes to point out multiple functions per ASP.NET page that could be made
Are there Windows API functions that allows reading what the current password policy is?
There are a couple of different .NET XSLT functions that I see used in
I've built a number of work-specific helper functions that could be useful for other

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.