> I would argue that is a very bad practice in php, to alter the actual > function parameter variable. That is because any stack trace obtained will > not reflect the initial value but the modified value. > > And generally, it is a bad practice to override a variable with some other > value that represents something different. You could have had incrementally: > $lowercaseValue, and $slug/$valueWithSlugNumber.
While I agree, we need to accept that often people do not use the best practices when coding. PHP makes the barrier to entry low, which invites people who are still learning what best practices are. I wanted to argue against this for exactly this reason, but it’s really not that bad. When combined with FCC, PFA, and pipe chaining, it can really condense code. My only hesitation is that what we’re going to end up with is a lot of: ``` $foo |>= a(…) $foo |>= b(…) $foo |>= c(…) ``` This completely defeats the spirit of this operation (and probably has terrible performance). Holly
