Making links clickable with PCRE in PHP


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



Copy this code and paste it in your HTML
  1. <?php
  2. // Making links clickable with PCRE in PHP
  3. // http://jeremy.visser.name/2007/08/06/making-links-clickable-with-pcre-in-php/
  4. $clickable = preg_replace('*https?://[A-Za-z0-9./?=+&%]+*', '<a href="$0">$0</a>', $input);
  5. ?>
  6.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.