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?

Just call the write function. The internals will take care of what you are suggesting. There's no need to convert to binary yourself.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.