[Solved] How to make short codes? php [closed]


You could use a templating engine.

But if you just want to replace all [bla] to bla(), you can use a regular expression:

$subject="[FUNC1] [FUNC2] [FUNC3]";
$pattern = '/\[(.*)\]/U';
$replacement="$1();";

echo preg_replace($pattern, $replacement, $subject);

On codepad.org: http://codepad.org/v0g02dtM

solved How to make short codes? php [closed]