PHP typecasting

Viewed 36577

I was wondering what is the best way to typecast a value from one type to another.

Which variant should we use:

  1. intval($value);
  2. settype($value, 'int')
  3. (int)$value

All of them produce same result.

4 Answers
Related