Convert lib_string to <a href="string">string</a> w/o Regex
<p>I need to convert <code>lib_someString</code>  to <code>&lt;a href="someString"&gt;someString&lt;/a&gt;</code> inside a block of text using str_replace [not regex].</p>

<p>Here's an example to give an exact sense what I mean: <code>lib_12345</code> => <code>&lt;a href="12345"&gt;12345&lt;/a&gt;</code>. I need to do this for a bunch of instances in a block of text.</p>

<p>Below is my attempt. Problem I'm getting is that my function is not doing anything (I just get lib_id returned). </p>

<pre><code>function extractLibId($val){ // function to get the "12345" in the above example 
    $lclRetVal = substr($val, 5, strlen($val));
    return $lclRetVal;
}

function Lib($text){ // does the replace for all lib_ instances in the text
    $lclVar = "lib_";
    $text = str_replace($lclVar, "&lt;a href='".extractLibId($lclVar)."'&gt;".extractLibId($lclVar)."&lt;/a&gt;", $text);
    return $text;
}
</code></pre>
