$string = "GIFT CARD CREDIT #[123456] (nt)";
preg_match("/\[([0-9]+)\]/", $string, $matches);
echo $matches[1];
A good basic PHP regular expression tutorial shoudl give some insight. Here is another tutorial that is a bit more complex but much more complete.
Basically, the pattern: /[([0-9]+)]/ just says (by the way, a pattern is typically enclosed in // chars), find a bracket "[" (escaped as "[") followed by 0-9 at least 1 time (designated by the "+") and then find a closing "]". by wraping "[0-9]" in parenthesis, we can render a sub-match which will be set in $matches. In other words, array index 0 in $matches will be the whole pattern "[123456]", where index 1 will have the sub-match "123456."
Cheers!