Function to return the ending index for the largest valid sub - string / starting from index i
< ? php function getEndingIndex ( $ str , $ n , $ i ) { $ i ++ ; while ( $ i < $ n ) { $ curr = $ str [ $ i ] ; $ prev = $ str [ $ i - 1 ] ;