PHP is not strongly typed
$IdUF = substr($rowData['IdMunicipio'],0,2)
returns a string
but if $IdUF
is used in an operation as its sum value
will be converted as follows:
<?php
$IdUF = substr($rowData['IdMunicipio'],0,2);
//$IdUF = "10" - Str
//Quando fazemos alguma operação
$IdUF++;
//$IdUF = 11 - Int
Now if the problem is at the time of saving in the bank the solution depends on how you are implemented.
One solution to forcing the value is to cast or convert between the solutions you could:
<?php
$IdUF = (int)substr($rowData['IdMunicipio'],0,2);
//ou
$IdUF = intval(substr($rowData['IdMunicipio'],0,2));
//Dessa forma o $IdUF será sempre inteiro, caso seja retornando
//um valor que ele não consiga converter como "olá"
// o valor de $IdUF será 0.