Change http to links

say i have a varable


what i want to do is find any word begining with http:// and change it to a link by adding the code <a herf u know wat i mean

how do i do that?
i think i could use preg_replace but how do i use that funtion ?