Answer the question
In order to leave comments, you need to log in
How to create a null-terminated string in php?
To communicate with the device I use sockets and php.
The following code works fine: we take a null-terminated string and send it to the socket
$msg = "\x00\x00\x00\x00\x63\x03\x67";
socket_write ( $socket , $msg, strlen($msg));
$data = "00000000630367";
$msg = "\x".implode("\x",str_split($data,2))
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question