Can not believe I have to ask, Google failed me. Just a future reference type question. How do you cast a property as decimal?
`var (decimal)$price;`
Can not believe I have to ask, Google failed me. Just a future reference type question. How do you cast a property as decimal?
`var (decimal)$price;`
I guess my question is do i have the correct syntax for casting a property as a decimal? I’m coming from .Net world c# so we always declare the data type.
Since php is duck typed, the type is interpreted and doesn’t get declaration. So the var is not needed like you would use for an open ended declaration in C#
$dec = 1.50;
echo gettype($dec);
// double