Skip to content

Instantly share code, notes, and snippets.

@jasny
jasny / linkify.php
Last active May 26, 2024 20:40
PHP function to turn all URLs in clickable links
<?php
/**
* Turn all URLs in clickable links.
*
* @param string $value
* @param array $protocols http/https, ftp, mail, twitter
* @param array $attributes
* @return string
*/
public function linkify($value, $protocols = array('http', 'mail'), array $attributes = array())