<?php
$array = [0, 1, 2];
$ref1 =& $array[1];
$ref2 =& $array[2];
$array[3] =& $array[2];
$r0 = ReflectionReference::fromArrayElement($array, 0);
$r1 = ReflectionReference::fromArrayElement($array, 1);
$r2 = ReflectionReference::fromArrayElement($array, 2);
$r3 = ReflectionReference::fromArrayElement($array, 3);
var_dump( $r0, $r1 );
echo base64_encode( $r1->getId() ), "\n";
echo base64_encode( $r2->getId() ), "\n";
echo base64_encode( $r3->getId() ), "\n";