• Exact Online Tips
  • Music
  • What is my IP
  • TYPO3 CMS
  • Linux
  • PHP
  • Webdevelopment
  • Miscellaneous

Back to overview

PHP

Add href inside string

30-03-17
0
public function str2href($str) {
    $str = preg_replace('/\s(\w+:\/\/)(\S+)/', ' <a href="\\1\\2" target="_blank">\\1\\2</a>', $str);
}
Share post: Facebook Twitter Pinterest

Back to overview

More related posts

PHP

Convert timestamp to range date string

Read more
04-04-17
1
PHP

Break to newline

Read more
30-03-17
0
PHP

Convert PHP array to Bootstrap grid

Read more
30-03-17
0
PHP

Convert PHP array to Bootstrap table

Read more
30-03-17
0
PHP

Find the position of the Xth occurrence of a substring in a string

Read more
30-03-17
0
PHP

Move array to bottom or to top

Read more
30-03-17
0
PHP

Convert filesize to human readable size

Read more
30-03-17
0
PHP

Convert MySQL column names to PHP array

Read more
30-03-17
0
PHP

HEX to RGB

Read more
30-03-17
0
PHP

Sort array by key (human order)

Read more
30-03-17
0
PHP

Compare string by array

Read more
30-03-17
0
PHP

Flatten array

Read more
30-03-17
0
PHP

Highlight matching keyword in a string

Read more
30-03-17
0
PHP

Normalize special characters

Read more
30-03-17
0
PHP

Check URL without downloading the body

Read more
30-03-17
0
PHP

XML to PHP array

Read more
30-03-17
0
PHP

Image to extension

Read more
30-03-17
0
Copyright © 1981-2018 Bas van Beek | Maasdijk 62 | 5308 JD Aalst Gld | Tel: 0418-820211 | E-mail: sales@bvbmedia.nl
Gerealiseerd door Webshop bouwer met Beste Webshop