How can I get the byte array from some string which can contain numbers, letters and so on? If you are familiar with Java, I am looking for the same functionality of the getBytes() method.
I tried a snippet like this one:
for($i = 0; $i < strlen($msg); $i++){
$data.=ord($msg[$i]);
//or $data[]=ord($msg[$1]);
}
but without success, so any kind of help will be appreciated.
PS: Why do I need this at all!? Well, I need to send a byte array via fputs() to a server written in Java...