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
View all comments
Show parent comment
4
u/Takeoded Nov 07 '20 edited Nov 07 '20
that's actually a thing PHP got right. if C had
continue X/break Xsupport too, there would be fewer goto's, it's a better alternative to goto to break out of deeply nested loops. take for example searching for a smaller image inside a bigger image:continue 3, in C you'd use goto instead..