ascii to decimal

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
scinor
Forum Newbie
Posts: 1
Joined: Mon Mar 29, 2010 8:16 am

ascii to decimal

Post by scinor »

Hi Everyone,

I have a value: �šš
which need to become: 0, 31, 22, -102, -102, 6

When is use ord

$code = "�šš";
echo(ord($code[0]));
echo(ord($code[1]));
echo(ord($code[2]));
echo(ord($code[3]));
echo(ord($code[4]));
echo(ord($code[5]));

The outcome = 0, 31, 22, 154, 154, 6

Could anyone help me out on this one?
The original code is in java and when using �šš it automaticly become's 0, 31, 22, -102, -102, 6 in a string.

Thanks in advance.
User avatar
omniuni
Forum Regular
Posts: 738
Joined: Tue Jul 15, 2008 10:50 pm
Location: Carolina, USA

Re: ascii to decimal

Post by omniuni »

I think your problem may be in your character encoding. The character, whatever it is, is not displaying on my computer, which likely means that it is not utf-8.
Post Reply