Try out LZW data compression using my PHP implementation below - try encoding the article taken at random from Wikepdia or input your own text for encoding.
LZW doesn't work well with short strings. Try encoding 'hello'!
The encoded output will hopefully be shorter than the input!
The first 16 bits of the output are used to store the number of bits used to encode each codeword.