Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function retUrls($str){
- $motek = array();
- $c = substr_count($str,'http://');
- while(strpos($str,'http://') !== false){
- $m = strpos($str,'http://');
- $sub = mb_substr($str,$m);
- $n1 = findSpace($sub);
- $n = getA($n1);
- $str = str_replace($n1,$n,$str);
- }
- $str = str_replace('http::','http:',$str);
- return $str;
- }
- function findSpace($s){
- $p = explode(' ',$s);
- return $p[0];
- }
- function getA($a){
- $a = str_replace('http:','http::',$a);
- return '<a href="'.$a.'">'.$a.'</a>';
- }
- echo retUrls("motek motek http://bobo.com boboi http://mongol.com sdfsdfa");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement