mysql - PHP code to present query result present as html, and add hyperlink to text that is a url -
i have cell in database $data. contain data. of data might contain url.
using mysql need php return text out of cell, hyperlinking url. found preg_replace function elsewhere on overflow not working.
im trying find code extract $data present $data text plus hyperlinked url.
i found this:
preg_replace('/\b(https?:\/\/(.+?))\b/', '<a href="\1">\1</a>', $text);
but a) not working , b) need statement extract $data first
live regex says works: http://www.phpliveregex.com/p/aqb (click on preg_replace on right).
$data = \preg_replace('/\b(https?:\/\/.+)\b/i', '<a href="\1">\1</a>', $data);
Comments
Post a Comment