I want to remove the first character of a string like so,
$a1 = "A10";
$a2 = substr($a1,1,strlen($startsem1)-1);
but I want to retrieve that removed "A" later on. Is there a way I can "cut" or "copy" that removed "A" to some variable?
I want to remove the first character of a string like so,
$a1 = "A10";
$a2 = substr($a1,1,strlen($startsem1)-1);
but I want to retrieve that removed "A" later on. Is there a way I can "cut" or "copy" that removed "A" to some variable?
Did you mean:
$a1 = "A10";
$a2 = substr($a1,1,strlen($a1)-1);
echo $a1[0]; // output "A" eg old value for you
echo $a2; // output "10"
PHP supports array like syntax for strings too so $a1[0]
(zero based index as in array) extracts first letter from string.