Hi,
returns
array(4) { [0]=> array(4) { [0]=> array(4) { [0]=> array(0) { } ["file_name"]=> string(51) "01_04_2016.doc" ["file_size"]=> float(138) ["file_type"]=> string(18) "application/msword" } ["file_name"]=> string(63) "09_04_2016.doc" ["file_size"]=> float(143) ["file_type"]=> string(18) "application/msword" } ["file_name"]=> string(51) "07_04_2016.doc" ["file_size"]=> float(143.5) ["file_type"]=> string(18) "application/msword" }
How do I index such array in a loop?
Thank You
3 1262
that array is already indexed.
i meant how do i loop through such array
usually you would loop through an array using foreach, but your array is created in an odd way that makes it hard to use.
your array with indentation - array(4) {
-
[0]=> array(4) {
-
[0]=> array(4) {
-
[0]=> array(0) {
-
}
-
["file_name"]=> string(51) "01_04_2016.doc"
-
["file_size"]=> float(138)
-
["file_type"]=> string(18) "application/msword"
-
}
-
["file_name"]=> string(63) "09_04_2016.doc"
-
["file_size"]=> float(143)
-
["file_type"]=> string(18) "application/msword"
-
}
-
["file_name"]=> string(51) "07_04_2016.doc"
-
["file_size"]=> float(143.5)
-
["file_type"]=> string(18) "application/msword"
-
}
as you can see, the data are put into different levels, which make it hard to work with. it would be easier to have the data in a more sensibly organised way, e.g. -
array(3) {
-
[0]=> array(3) {
-
["file_name"]=> string(51) "01_04_2016.doc"
-
["file_size"]=> float(138)
-
["file_type"]=> string(18) "application/msword"
-
}
-
[1]=> array(3) {
-
["file_name"]=> string(63) "09_04_2016.doc"
-
["file_size"]=> float(143)
-
["file_type"]=> string(18) "application/msword"
-
}
-
[2]=> array(3) {
-
["file_name"]=> string(51) "07_04_2016.doc"
-
["file_size"]=> float(143.5)
-
["file_type"]=> string(18) "application/msword"
-
}
-
}
eventually, I recommend to fixd this' array creation before you proceed with the array data.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: lawrence |
last post by:
I wanted to test xml_parse_into_struct() so I took the example off of
www.php.net and put this code up on a site:
<?php
$simple = <<<END
<item>
|
by: Michael Drumheller |
last post by:
(If you're not interested in NumArray, please skip this message.)
I am new to NumArray and I wonder if someone can help me with
array-indexing. Here's the basic situation: Given a rank-2 array...
|
by: Acacia |
last post by:
i get this error on any line with dot notation. Oh, and do I need to use
cin.getline(boy.name)?:
error:'.':left operand points to 'struct' use '->'
This is the program in question:
...
|
by: IWP506 |
last post by:
Hey,
I'd like to make an array with one index for each letter of the
alphabet. OK, easy enough. But instead of referencing the letter J
with array, can I enumerate every letter with A being 1...
|
by: Joshua Neuheisel |
last post by:
The following code compiles with gcc 3.2.2 and Visual C++ 6:
#include <stdio.h>
int main()
{
int a = {3, 4};
printf ("%d\n", 0);
return 0;
}
|
by: Hal Styli |
last post by:
hello, can someone please help...
Im interested in the use of an auxiliary
array to act like pointers for another
array, allowing the sort order to be
traversed. See code below.
I dont have an...
|
by: Anjali |
last post by:
Hi,
I am handling an array with a hexadecimal index for the first time.
What actually does the below means.
arr = { '@','£','$','@','@','@','@','@','@','@', 10,'@', 13,'@','@','@',...
|
by: Mario |
last post by:
Hi there,
I'm writing a piece of code with VS.Net 2003, Framework 1.1.
And I can't make BinarySearch to work right. Look at this sample:
Dim sexy() As String = {"-", "a", "b", "ba", "A",...
|
by: John Dolan |
last post by:
Hi all, I need some help here.
I have an ActiveX object that requires me to pass in an array that is
1-based (as opposed to the normal 0-based index). Unfortunately the author
of the ActiveX...
|
by: Jay G. Scott |
last post by:
this should be trivial, yet i can't find it in a tutorial.
int AAA;
int BBB;
i want to call f(AAA,12,234) and f(BBB,98,2478).
how should f be declared?
int f( huh?, int ll, int rr)
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |