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 fail to understand what is difficult about it..
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.

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

Reply via email to