PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, November 2, 2022

[FIXED] How can I get an index of a two dimensional array?

 November 02, 2022     arrays, indexing     No comments   

Issue

I have a two-dimensional array like this:

(0|0),(0|1),(0|2)
(1|0),(1|1),(1|2)

I know the width and height of the array. I want to calculate the indexes as a single number like this:

0,1,2
3,4,5

How do I do this?


Solution

Looks like index = row * width + column to me.



Answered By - jurez
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing