dealing with numbers in php

Red Squirrel

No Lifer
May 24, 2003
71,304
14,081
126
www.anyf.ca
I'm writing a program in php that needs to communicate with a server using a custom protocol. I need to be able to send data numericly, and occupy a specified number of bits/bytes.

Ex say I have this packet

size | field name
8bit | header
16bit | 2 byte integer

How do I go about sending the packet so the fields have this value:

250
60000


Which would equal this in hex:

FA EA 60

Basically I'd like to be able to manipulate at the bit level, to some extent.