re: I Want Scalar Objects in PHP VIEW POST

re: well, i personally dont care, php as not strictly typed language curently is not ready for this. imho. ps: in last snippet you have syntax error. :...

But we are slowly heading in that direction, far too slowly really. Strict types help you code better and stop of lot of issues that can take time to debug.

PHP 7 made some headway here with strict_types, if you don't want it don't set it to true, or just leave out your type hints altogether - very sloppy!

Personaly I'd love to have fixed types for variables:

int $myInt = 1;
string $myString = "1234";
bool $myBool = 45;  // Fails 
int $myInt2 = "5678";  // Fails

Or even better without the annoying $ prefix which does nothing IMHO:

int myInt = 1;
string myString = "1234";
bool myBool = 45;  // Fails
int myInt2 = "5678";  // Fails

Yes, all those Ruby and Smalltalk developers are producing completely unusable garbage because they lack manifest typing. /s

I like PHP's dynamic loose scripting nature. If you want that more verbose kind of thing, there is Java, or Swift, or whatever.

PHP's current nature fulfills a unique niche in my toolkit and I like it the way it is (although I'm all for consistent naming and moving to a more dynamic OO style).

code of conduct - report abuse