Is there an easy way to read a single line with php sockets?

Red Squirrel

No Lifer
May 24, 2003
70,148
13,565
126
www.anyf.ca
I'm writing a php script that will be used with ajax and I need to be able to read one line at a time from the socket. The protocol sends data in lines of variable length so rather than reading a specific amount of bytes it's easier to just read until I hit \r\n. I can probably code this, but just wondering if there is a built in function for that? I can't seem to find one. It would be more efficient than reading one byte at a time so I can check for EOL. This is small bits of data so efficiency is not really a huge priority, but still.