= 1) { //Separate link from extranneous text $string_pass_two = explode('[/url]', $string_pass_one[$i]); //Drop first character of string (left over from [url= or [url] $string_pass_two[0]=substr($string_pass_two[0],1); //Explode by the "]" if present $link = explode(']', $string_pass_two[0], 2); //If the url was of [url] format, set variable as it is currently unset if (!isset($link[1])) { $link[1] = $string_pass_two[0]; } //Ensure http:// is present in link $link[0] = ('http://'.str_replace('http://', '', $link[0])); //Compile string $compiled_string .= "$link[1]$string_pass_two[1]"; } } print nl2br( $compiled_string ); ?>