Question: I have an array called followers and I would like to know how I could get the objectAtIndex $a of the array in PHP.

My current code is this, but it doesn't work: 

```
    $followers = anArray....
    $returns = array();
    for ($a = 1; $a <= $numberOfFollowers; $a++) {
        $follower = $followers[$a];
        echo $follower;
        $query = mysql_query("query....");
        if (!$query) {}
        while ($row = mysql_fetch_assoc($query)) {

        }
    }

```

edit--- This is how I get the followers:

```
    $followers = array();
    while ($row = mysql_fetch_array($querys)) {
        $followers[] = $row['followingUserID'];
    }
    $numberOfFollowers = count($followers);

```

Answer: 
Why not do a `foreach()`, like this?

```
$followers = array();
$returns = array();
foreach($followers as $index => $follower){
    echo $follower;
    $query = mysql_query("query....");
    if (!$query) {}
    while ($row = mysql_fetch_assoc($query)) {

    }
}

```

I don't know what you are cooking with this, but to me, this is a huge cannon shooting towards the DB. Try to optimize your queries into a single one. Don't ever imagine DB fetches with a loop in your mind.
It looks like every element of `$followers` is a value returned from `mysql_fetch_assoc()`. Each element will be an associative array, and when you echo it I would expect to see it echoed as the string `'Array'`, since that is PHP's usual behaviour.

One point to observe is that when you create an empty array using `array()` and then populate it using assignments of the form `$myarray[] = ...`, the resulting array will be zero-indexed. That is, the keys of the array will start at 0, not at 1. So instead of `for ($a = 1; $a <= $numberOfFollowers; $a++) {`, you need to use `for ($a = 0; $a < $numberOfFollowers; $a++) {`, or go for the solution suggested by @Shef and use `foreach`.

Your problem might arise because `$followers` contains only one element, and because of the off-by-one error, you are not seeing any output. Turn on error reporting by adding this line at the start of your script:

```
error_reporting(E_ALL & ~E_STRICT);

```

If I am right then with your current code, you should see a `Notice: Undefined index: 1 ...`