For a large project we're using a BBCode parser named NBBC 1.4.5 (http://nbbc.sourceforge.net).
NBBC: The New BBCode Parser
NBBC is a high-speed, extensible, easy-to-use validating BBCode parser that accepts BBCode as input and generates XHTML 1.0 Transitional-compliant markup as its output no matter how mangled the input. It includes built-in support for most common BBCode, as well as external-wiki support, image-library support, a standard library of smileys (emoticons), and via its powerful API it can even be transformed into a validating HTML parser!
but switching from PHP5 to to PHP7 I had to make a couple of easy fixings.
Change the row:
function BBCodeLexer($string, $tagmarker = '[') {
with:
function __construct($string, $tagmarker = '[') {
And then change, in the same way, also the row:
function BBCode() {
with:
function __construct() {
This fixed the problem.