note 86709 modified in function.substr by danbrown

From: Date: Fri, 31 Oct 2008 01:17:06 +0000
Subject: note 86709 modified in function.substr by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-145986@lists.php.net to get a copy of this message
hi, really basic function to take blob with full http url's and turn then into "more info" links, handy for page layout etc ;) <?php function urltolink($data){ while (strpos($wdata, "http")) { $op=strpos($wdata, "http"); $rdata=substr($wdata, 0, $op); $ndata=substr($wdata, $op, strlen($wdata)-$op); $cp=strpos($ndata, "\n"); $link=substr($ndata, 0, $cp); $oc=$op+$cp; $wdata=substr($wdata, $oc, strlen($wdata)-$oc); $edata=$edata."$rdata <a href=\"$link\">more info</a><br />"; } return $edata; } ?> --was-- hi, really basic function to take blob with full http url's and turn then into "more info" links, handy for page layout etc ;) function urltolink($data){ while (strpos($wdata, "http")) { $op=strpos($wdata, "http"); $rdata=substr($wdata, 0, $op); $ndata=substr($wdata, $op, strlen($wdata)-$op); $cp=strpos($ndata, "\n"); $link=substr($ndata, 0, $cp); $oc=$op+$cp; $wdata=substr($wdata, $oc, strlen($wdata)-$oc); $edata=$edata."$rdata <a href=\"$link\">more info</a><br />"; } return $edata; } http://php.net/manual/en/function.substr.php

« previous php.notes (#145986) next »