[PHP] Weird class problem?

arxanas

New member
Okay, so I've got this problem with PHP classes. It says that there's an unexpected T_NEW. From what I can gather, I can't use this bbcode parser in the class I'm making. Is there anything I'm doing wrong here?

Code:
<?php
require_once("./nbbc/nbbc.php"); //This is the BBCode parser thing
/*
* Normally, you use this parser by doing this:
* $bbcode = new BBCode;
* $bbcode->Parse("some text here");
*/
class text {
var $bbcode = new BBCode;
public function text () {
}
public function secure ($str) {
return mysql_real_escape_string($str);
}
public function parseText ($str) {
echo $this->bbcode->Parse($str);
}
}
$text = new text();
$text->parseText("This is some text!")
?>
 
Would this work for you? if not i'll find another way

class text {
public function text ()
{
}
public function secure ($str)
{
return mysql_real_escape_string($str);
}
public function parseText ($str)
{
echo BBCode::Parse($str);
}
}
 
Back
Top