I have the following string which i need to convert to integer or bigint.
$test=\"99999977706\";
I tried:
echo (int)$test;
In your snippet $test is already a number, more specifically a float. PHP will convert the contents of $test to the correct type when you use it as a number or a string, because the language is loosely typed.