Hi all,
I have got a number like 89 or anything, And I want to count it like 8+9 =17 and then if it is more than 9 then count it again ..like 1+7=8
So my problem is I am unable to get any function which reads each charactor in a string or integer..
Can anybody help me ??
Tabish
try accessing the individual characters using the {} syntax:
$str="12";
$total=$str{0}+$str{1};
$total will equal 3;
No it is not working please help me..
$sum = substr($var, 0,1) + substr($var, 1,1);
if var is 13, $sum will be 4.