Forum Moderators: coopster
There are a number of ways to get the results you want. You could use a combination of PHP's String Functions [php.net], or POSIX-extended regex functions [php.net], but I would elect one of the PCRE [php.net] (Perl Compatible Regular Expression) functions:
# Get data between any numeric bracket markers:
$text = '[1]how are you[2] today?';
$value = preg_replace [php.net]("/.*\[\d+](.*)\[\d+].*/", "$1", $text, 1);
# Get data between any numeric bracket markers:
$text = '[1]how are you[2] today?';
preg_match [php.net]("/\[\d+](.*)\[\d+]/", $text, $matches);
$value = $matches[1];