Skip to end of metadata
Go to start of metadata
Link to PHP's language reference:

Please have a look at PHP's page above, TSPHP treat int more or less the same.

However, TSPHP does not support implicit castings from float, string, arrayresourcemixed and Classes and Objects to int. Thus the following statements would all cause a compiler error:

Would cause a compiler error
int $float = 1.0;
int $int = "1";
int $array = array();
resource $res; // this statement is ok
int $resource = $res;
mixed $mix = 1; //this statement is ok
int $mixed = $mix;
int $class = new Foo();

However, bool can be assigned to int due to an implicit cast form bool to int (see Type juggling).

int $a = true; //$a is still true
int $b = false; //$b is still false

Not supported

Please be aware that the alias integer is not supported by TSPHP. Not in the declaration of a variable, return type etc. nor for casting purposes

  • No labels