Php - Agregar href en textos

/ Published in: PHP
Save to your folder(s)

Genera links en base a http, www, ftp

Copy this code and paste it in your HTML
  1. function ponerLinks( $str ){
  2. $tmp = eregi_replace('((ftp|http|www)[[email protected]:%_\+.~#?&//=]+)', '<a href="\\1" target="_blank">\\1</a>', $str);
  3. return str_replace('href="www.','href="http://www.', $tmp);
  4. }

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.