PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Then I try to make the following calculation (array multiplication) but for some reason I don't understand why $t is always zero. I read somewhere that floatval cannot by used with arrays so I tried the multiplication without the floatval function but still the same error.
I would be grateful, if you could give me some help on this.
Sorry, I didn't address the typecasting part of your question. There is implicit casting that takes place in situations like this. For example, when performing an arithmetic operation with an integer value and a float value as operands, the integer is automatically converted to a float so that the operation can take place. There is a possible loss of precision here for very large ints (over a billion or so), as only the leading 9 (if i remember correctly) sig bits are moved to the mantissa to make room for the exponent part. In general, explicit typecasting of primitives is unnecessary unless you are trying to override this default behavior.
If you're looking to be really accurate look into the BC Math library here: http://us3.php.net/bc