999999999 is too big. Try making it a bit smaller. You may have to test, but if I am not mistaken I think 255 is the size limit. If you need it to be bigger, then perhaps you should use a different way to test your string.
If you are testing to make sure every character in your string is a digit from 0-9, why don't you just use is_numeric:
elseif (!is_numeric($gold))