On Tue, Nov 28, 2023, at 7:49 PM, Juliette Reinders Folmer wrote:
> L.S.,
>
> What with all the drives towards cleaner code, how do people feel 
> nowadays about `extract()` and `compact()` still being supported ?
>
> Both have alternatives. The alternatives may be a little more cumbersome 
> to type, but also make the code more descriptive, lessens the risk of 
> variable name collisions (though this can be handled via the $flags in 
> extract), prevents surprises when a non-associative key would be 
> included in an array and lessens security risks when used on untrusted data

*snip*

> I can imagine these could be candidates for deprecation ? Or limited 
> deprecation - only when used in the global namespace ?
>
> For now, I'm just wondering how people feel about these functions.
>
> Smile,
> Juliette

extract() has very limited use in some kinds of template engine, which use PHP 
require() as a template mechanism.  I don't think compact() has any uses.

I very recently was just reminded that these even exist, as i had to tell one 
of my developers to not use them.  I think it was compact() he was trying to 
use.  I vetoed it.

I would not mind if they were removed, but I don't know how large the BC impact 
would be.  They'd probably need a long deprecation period, just to be safe.

--Larry Garfield

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to