Hello I have a dynamic text and I want to add code like all the forums like this: 
[code]My code here...[/code]

Is there an easy way to have a function in PHP to do this stuff?? For example if I write on my text:

Hello world example with PHP [code]echo "hello "world";[/code] and an addition example with PHP [code] echo 5+5; //The result will be 10[/code] etc...

Will apear:

Hello world example with PHP

```
<?php echo "hello "world"; ?>

```

and an addition example with PHP 

```
<?php echo 5+5; //The result will be 10 ?>

```

etc....