Print an Array | Resolved!


#1







<?php
$tens = array(10, 20, 30, 40, 50);
echo $tens[0]
echo $tens[1]
echo $tens[2]
echo $tens[3]
echo $tens[4]

  ?>
</p>


This is what I have so far; what am I missing in order to "print" the array? When I simply put $tens[3] it still says an error, which makes sense b/c it's making sure I understand the 0-4 order.

("...there's an array named $tens. Use echo to output the third item in $tens. Remember that items are numbered starting from 0.")


#2

That would be,

echo $tens[2];

Using offsets, we can reason that the first element will have 0 offset, the second will be offset by 1, and the third, offset by 2.


#3

ahahahaha! I'm so embarrassed, but thank you soooo much! Brownie points for you!