Posted by Vince Morgan on 04/19/07 13:37
"Vince Morgan" <vinhar@REMOVEoptusnet.com.au> wrote in message
news:46276af7$0$16552$afc38c87@news.optusnet.com.au...
> You could reduce the if; elseif block to the following.
>
> $string[$i] = $string[$i]< 5 ? $string[$i]+=5 : ($string[$i]+=5)-10;
>
> That's if, as Jeff has already enquired, $string{$i} should be
$string[$i].
> HTH
> Vince
>
>
Ooops, I forgot you are dealing with chars rather than integers.
$string[$i] = $string[$i]< "5" ? $string[$i]+=5 : ($string[$i]+=5)-10;
Vince
Navigation:
[Reply to this message]
|