<pre><code>$array = explode(&quot;.&quot;, $row[copy]);
$a = $array.length -1;
</code></pre>
<p>I want to return the last element of this array but all i get from this is -1.</p>

I think your second line should be more like:
```
```
$index = count($array) - 1;
$a = $array[$index];
```
```
If you want an element from an array you need to use square brackets.