Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[PHP]add bytes to string

Joined
Sep 30, 2003
Messages
1,270
Reaction score
10
Hey coders, i need some help, i'm doing some EPP standard stuff

and i have this xml and EPP standard says you need to add 4 bytes to the top of the xml with the total xml size (xml + 4 bytes),

anyways i was doing that like this, since UTF-8 characters are 1byte long
PHP:
$output;
$output = dechex(strlen($output)+4) . $output;

anyways that would prepend the hex value of the total $output size but less then 4 bytes so i did this:

PHP:
$size = dechex(strlen($output)+4);
while(strlen($size) <= 5){
	$size = '0' . $size;
}
$output = $size . $output;

this way i would allways get 4bytes at the top of the message, but atm those 4 bytes are just numbers and not bytes so how do i "encode" them? i've tried utf8_encode with no sucess.

heres the document that guides de EPP standard i'm trying to follow (in case i didn't made my point :p)

GriffinHeart - [PHP]add bytes to string - RaGEZONE Forums



any help apreciated.
 
Back
Top