You can use preg_match as
$input_line = 'Re: [Ticket #6588] Site security update' ;
preg_match("/\[Ticket #(.*?)\]/i", $input_line, $output_array);
echo $output_array[1];
/\[Ticket #(.*?)\]/i
\[ matches the character [ literally
Ticket # matches the characters Ticket # literally (case insensitive)
1st Capturing group (.*?)
.*? matches any character (except newline)
Quantifier: Between zero and unlimited times, as few times as possible, expanding as needed [lazy]
\] matches the character ] literally
i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])