I was wondering what is the best way to typecast a value from one type to another.
Which variant should we use:
intval($value);
The answer here is to use whatever reads "cleaner" to you. Any difference in speed is going to be so minor, that worrying about it is almost certain to cost you more time than you are liable to save. What will save time, however, is having code that you can read and understand in the future.
There's an excellent article explain this very thing at Coding Horror.