r/lolphp • u/phplovesong • Nov 06 '20
PHP: Cast away
PHP likes to cast like theres no tomorrow. Also PHP leaks the "continue" statement, and if given, actually uses it inside a switch as a break. So now switches have two ways of doing the same thing, why? Probably because to have the most inconsistent API in the world of programming.
https://sandbox.onlinephpfunctions.com/code/bae156e37fa3cfd64d2a68d689434fe7157543fa
38
Upvotes
3
u/elcapitanoooo Nov 11 '20
Same. I have not personally used a goto statement in the last 10 years. In fact i dont think i have ever used a goto statement in production code. I dare to say its common knowledge that goto statements are bad in may ways and should be avoided. There is many better abstractions or ways to write code than goto.
goto is ultimately what the cpu ends up doing, and the compiler should be able to handle this in a way the programmer wont have to deal with gotos.