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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.