How do I send the binary representation through a PHP socket?

Hi there,

I’m trying to send the binary representation of data through a PHP socket.
So if the number was 15, socket_write would send 00001111 as binary representation for 15.

How should I do this?

Hi,
You can use the decbin($nr) to convert a number into a binary. Then, send the result.
More about decbin() on this address:
php.net/manual/en/function.decbin.php

Thanks :slight_smile: