Quote:
Originally Posted by Brad
Yes, they work on single characters.
|
I don't think so, str_to_num takes an array, not a single chars as parameter.
And the reason I used this is that I'm manually copying every converted char to a single array element. If using str_to_num, I'd have to make a 2-element array, and just read the first one, and call a native and go all the way back to the VM again.
EDIT: A little optimization if you guys prefere it:
PHP Code:
num_to_char(num)
{
if(num < 0 || num > 9)
return '^0'
return('0' + num)
}
char_to_num(char)
{
if(char < '0' || char > '9')
return 0
return (char - '0')
}
__________________