I'm trying to pull specific data from a PHP multidimensional array.
Array is like so:
Array
(
[0] => Array
(
[0] => Item Code Number
[1] => Item Name
[2] => Item Description
[3] => MSRP
[4] => Cost
[5] => Weight Pounds
[6] => Weight Kgs
[7] => Category 1
[8] => Category 2
[9] => Category 3
[10] => Category 4
[11] => Youtube Link
[12] => Large Image URL
)
[1] => Array
(
[0] => 1
[1] => Amazing Magic Set
[2] => Easy to learn magic tricks
[3] => 24.95
[4] => 10.5
[5] => 0.95
[6] => 0.43
[7] => New Items
[8] => Tricks
[9] => *New Tricks*
[10] => All Tricks
[11] => blank
[12] => http://www.magicmakersinc.com/images/product/large/0051.jpg
)
)
What I want to do it loop through the array and pull keys, 0, 1, 2, 4, 6 from each entry and display that data.
This is what I've tried to use:
$keys = (array_keys($csv));
for ($row = 0; $row < sizeof($csv); $row++) {
echo "<tr>";
foreach($keys[$row] as $key => $value) {
echo "<td>".$value."</td>";
}
echo "</tr>";
}
I can't get this to display anything.
I've also tried:
for($i = 0; $i < count($csv); $i++) {
echo "<tr>";
foreach($csv[$keys[$i]] as $key => $value) {
echo "<td>".$value(0)."</td>";
}
echo "</tr>";
}
I can't figure out what I'm doing wrong. Any help would be great.