These all have different uses.
Settype will change the $var zval to that of the type given. So if I originally had a double, and used settype on it to cast to an integer, it will permanently become an integer and truncate the floating point (by changing which union type it is using).
Cast notation [(int)] beats intval() performance wise. But intval does let you convert a string number into an integer with base conversion which (int) does not. So I can convert 0123 to the correct 83 using intval(), but (int) would result in 123.
So, if you want to permanently change (string)$var type to integer, use settype. If you want to change it as you reassign to a different variable (or I guess even to itself), you can use the (cast) notation. If you want to use potential conversion of something like an octal, use intval. These all go for pretty much every *val() type. Also, settype is the only one that can really be used dynamically logic wise. You cannot cast to a constant or variable type, but settype will accept a string.
Actually I lied, the *val() will too since these are not constructs. So you can use variable functions to call them. (cast) notation is the only one that's actually locked into being hand written. I'm fine with that though, I typically use (cast) syntax.
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php