How would I go about grabbing the last 7 characters of the string below?
For example:
$dynamicstring = \"2490slkj409slk5409els\";
$newstring = some_f
It would be better to have a check before getting the string.
$newstring = substr($dynamicstring, -7);
if characters are greater then 7 return last 7 characters else return the provided string.
or do this if you need to return message or error if length is less then 7
$newstring = (strlen($dynamicstring)>7)?substr($dynamicstring, -7):"message";
substr documentation