# How to push a 2-dimensional array?

**URL:** <https://forum.kirupa.com/t/how-to-push-a-2-dimensional-array/192877>\
**Category:** Uncategorized\
**Created:** [July 2, 2006, 9:24am UTC](https://forum.kirupa.com/t/how-to-push-a-2-dimensional-array/192877 "2006-07-02T09:24:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tanel96](https://avatars.discourse-cdn.com/v4/letter/t/5fc32e/32.png) [@tanel96](https://forum.kirupa.com/u/tanel96)\
**Post date:** [July 2, 2006, 9:24am UTC](https://forum.kirupa.com/t/how-to-push-a-2-dimensional-array/192877/1 "2006-07-02T09:24:29Z")

</div>

I’m trying to achieve something like this:

```php

$fruits = array (
"fruits.jpg" => array("34262","5 Jun 09:49"),
"numbers.jpg" => array("54132","6 Jun 15:42"),
"holes.jpg" => array("12901","17 Aug 14:30")
);

```

Here is my code so far (haven’t been able to figure out, how to push the “$size” & “$date” variables into the array):

```php

<?php
$fruits = array();
$contents = ftp_rawlist($conn_id, "/path_to_the_folder/");
 
foreach ($contents as $entry) {
 
$entry = ereg_replace( "([\x20]+)", "\x20", $entry);
$entry = explode("\x20", $entry);
 
$filename = $entry["8"];
$size = $entry["4"];
$date = "".$entry["6"]." ".$entry["5"]." ".$entry["7"]."";
 
if($filename != "." && $filename != ".."){
array_push($fruits ,$filename);
}
}
?>

```
