$array = explode(".", $row[copy]);
$a = $array.length -1;
I want to return the last element of this array but all i get from this is -1.
You can also use:
$a = end($array);
This also sets the arrays internal pointer to the end of the array, but it does get you the last element easily.