"Andreas Hennings" wrote in message news:CAH0Uv3HQK5wjcd_-9GynMw34H78ZTv09q9bc=yZ10JBbeT=v...@mail.gmail.com...

On Fri, Aug 11, 2017 at 12:01 AM, Devnuhl Unnamed <devn...@gmail.com> wrote:
Would isset($suffix) not suffice here?

You mean like so?

list($prefix, $suffix) = explode(':', 'string_without_suffix');
if (!isset($suffix)) {
 ..
}

The isset() is too late here, because the list() will already cause an error.


Other concerns fall around list() already being a difficult thing for people to understand

I agree.

I fail to understand what is difficult about it.

The point is that other people have difficulty understanding what is supposed to be a simple feature which is now being expanded to include more options which change its behaviour.

And "destructuring" is a common concept in programming languages.
https://www.startpage.com/do/search ?query=destructuring&cat=web&pl=chrome&language=english
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment

The following already works in Javascript:
[a, b, c, d = 'else'] = ['aa', 'bb', 'cc'];
I just tried it in my Chromium console.

That fact that something like this exists in another language is no reason to add it to PHP.

--
Tony Marston


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

Reply via email to