I think your question has directed the unset error at the wrong place to be honest.
Unset DID work. It was the "for" loop that created the error.
The problem you had was that, when you unset the key you removed the key name "1". It didn't then update the array index, and as a result, the array then contained only the keys "0" and "2". "1" did not exist.
Your "for" loop then tried to look at $a[1] and it wasn't there. Yes, there are two elements left but they aren't called "0" and "1" but "0" and "2".
Solution: To remove an element from an array, but then update the index you need to do this......
$r = 1; // The index number you want to remove.
array_splice($a,$r,1);
// Get value you removed?
$ir = array_slice($a,$r,1);
echo "Just removed $ir[0] from array";