How does loosely typed structure of PHP go with object oriented nature of PHP?
Also, is PHP a pure object oriented language?
Thanks in advance.
I meant to point out the loosely typed nature of PHP. I meant the variable declaration, to be precise. How does this drawback of PHP go with its object oriented nature. Does PHP5 have pure object oriented features?
Nope, PHP is not a OOP-only language. In fact, they implemented OOP later on.
The losely typed nature of PHP can be a bitc*, but at the same time it can be very handy. I don’t really see a problem with that. If you want to use strict typing, you have to force it in your code. You can explicitely cast variables to a specific type:
$integer = (int) $stringVariableWithIntegerValue;And you can force a check on type using the
===operator. In my opinion PHP is not a complete OOP implementation, but it works pretty well since 5.x.