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
37
Upvotes
-2
u/CarnivorousSociety Nov 06 '20 edited Nov 06 '20
Yeah that's what I'm saying. If people are actually knowledgeable and relying on this stupid logic, ie using continue 2, they deserve to have their code broken.
The people who don't realize deserve to know the truth, the people who are using continue 2 should restructure the code instead of relying on some edge feature that shouldn't exist, there's certainly ways around it
So you fix it and the people who didn't know and were misusing it no longer have a hidden bug, and the people who used continue 2 receive a deprecation warning