This caught me by surprise. The code
$strA = '1234';
$strB = '56';
$cast = (int) $strA.$strB;
var_dump($cast);
outputs: string(6) "123456"
I was expecting $cast to be an integer. This behavior might cause a security hole if someone were putting together strings from $_POST. The code
$strA = '1234';
$strB = '56-SQL Injection';
$cast = (int) $strA.$strB;
outputs: string(20) "123456-SQL Injection"
If $strB were from an external source like $_POST; the script might be open to an injection attack.
I've been reading posts like the difference between (int) and intval() trying to find out where this full behavior of (int) is documented.
So my question is: I was expecting "(int) $strA.$strB" to be an integer. Why is it still a string and where is this behavior documented?