I have several strings that look like:
longname1, anotherlongname2, has1numbers2init3
I would like to use str_split
to split off the last character of the strings. Eg:
Array ( [0] => longname [1] => 1 )
Array ( [0] => anotherlongname [1] => 2 )
Array ( [0] => has1numbers2init [1] => 3 )
I can get the number alone using substr($string, -1);
but need to find an efficient way of retrieving the remainder of the string.
I have tried:
str_split($string,-1);
but of course this doesn't work.
Would anyone know what I could do?