Jump to content

BBCode function help


EchoFool

Recommended Posts

I have a function which i use to maintain the layout of the text block but i get an which i do not know what i have to do to correct. I have two areas on the same page using the same bb code function only i renamed the second one to avoid clashes.

 

This is what i got for my 2 functions:

1

<?php
function bbcode_format($Notes){
$Notes = htmlentities($Notes);
$simple_search = array(
                                '/\[b\](.*?)\[\/b\]/is'
                                );

        $words = array('[b]','[/b]');		
$code = array('<strong>','</strong>');

$Notes= str_replace($words, $code, $Notes);

        echo $Notes;
}
?>

 

2

<?php
function bbcode_format($Infomation){
$Infomation = htmlentities($Infomation);
$simple_search = array(
                                '/\[b\](.*?)\[\/b\]/is'
                                );

        $simple_replace = array(
                                '<strong>$1</strong>'
                                );

        // Do simple BBCode's
        $Infomation = preg_replace ($simple_search, $simple_replace, $Infomation);

        echo $Infomation;
}
?>

 

 

My error is this:

 

Fatal error: Cannot redeclare bbcode_format() (previously declared in C:\xampp\htdocs\pendingreports.php:122) in C:\xampp\htdocs\pendingreports.php on line 161

 

 

Relating to the second function..

Link to comment
https://forums.phpfreaks.com/topic/90386-bbcode-function-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.