The purpose this RFC using negative offsets is to extend the current positive indices support for strings and arrays to allow negative values.

Without the support of negative indices to find the character 'd' in 'Hello World' can be done in using various ways

$string = 'Hello World' ; // using substr $letter_d = substr ( $string , strlen ( $string ) - 1 ) ; // using a positive index value $letter_d = $string [ strlen ( $string ) - 1 ] ;

Using the same example but using a negative index would be

$string = 'Hello World' ; $letter_d = $string [ - 1 ] ;

The same could be applied to arrays that are not keyed

$array = array ( 1001 , 1002 , 1003 , 1004 ) ; // using a positive index value $number_1004 = $array [ count ( $array ) - 1 ] ; // or using array_slice $number_1004 = array_slice ( $array , - 1 , 1 ) [ 0 ] ;

Using a negative index