I've got several strings of the type id1, id2, id125, id1258, etc.
What I want to achieve using php is to strip the word "id" from those strings and get only the numbers in integer format in php. How can I do this?
I've got several strings of the type id1, id2, id125, id1258, etc.
What I want to achieve using php is to strip the word "id" from those strings and get only the numbers in integer format in php. How can I do this?
If these strings only begin with the string id
:
$number = intval(ltrim($number, 'id'));