[RFC] unset(): return bool if the variable has existed

php.internals

Bob Weinand

13 years ago
Hi! As this seem to require a RFC, here is it: https://wiki.php.net/rfc/unset_bool Please feedback, Bob Weinand

Steve Clay

13 years ago
On 3/6/13 4:10 PM, Bob Weinand wrote:
> https://wiki.php.net/rfc/unset_bool
What's the return value of unset($setValue, $undefined) ? Steve Clay
-- http://www.mrclay.org/

Bob Weinand

13 years ago
false. It's like unset($setValue) && unset($undefined). I've clarified this in the RFC; thank you. Bob Weinand Am 06.03.2013 um 22:24 schrieb "Steve Clay" <steve@mrclay.org>:

Florin Razvan Patan

13 years ago
Hello, On Wed, Mar 6, 2013 at 11:31 PM, Bob Weinand <bobwei9@hotmail.com> wrote:
> false. It's like unset($setValue) && unset($undefined). > > I've clarified this in the RFC; thank you. > > Bob Weinand > > Am 06.03.2013 um 22:24 schrieb "Steve Clay" <steve@mrclay.org>: > >> On 3/6/13 4:10 PM, Bob Weinand wrote: >>> https://wiki.php.net/rfc/unset_bool >> >> What's the return value of unset($setValue, $undefined) ? >> >> >> Steve Clay >> -- >> http://www.mrclay.org/ >>
Would it make more sense to return an array with keys the name of the variables that were unset and the result for each of them? This way one could better handle 'false' being returned. I'm not sure if it's possible or not, I didn't had the time to check out the patch. Thanks ---- Florin Patan https://github.com/dlsniper

Anthony Ferrara

13 years ago
Florin Would it make more sense to return an array with keys the name of the
> variables that were unset and the result for each of them? This way > one could better handle 'false' being returned. > > I'm not sure if it's possible or not, I didn't had the time to check > out the patch. >
If you need that much granularity, just call unset() individually for each one... Anthony

Ferenc Kovacs

13 years ago
On Wed, Mar 6, 2013 at 10:10 PM, Bob Weinand <bobwei9@hotmail.com> wrote:
> Hi! > > As this seem to require a RFC, here is it: > > https://wiki.php.net/rfc/unset_bool > > Please feedback, > > Bob Weinand > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >
unset is not a function, but a language construct, and there is at least one similar construct which doesn't return anything (eg. not returning NULL, but syntax error when used in a return context): echo
-- Ferenc Kovács @Tyr43l - http://tyrael.hu

Ferenc Kovacs

13 years ago
On Wed, Mar 6, 2013 at 10:38 PM, Ferenc Kovacs <tyra3l@gmail.com> wrote:
> > > > On Wed, Mar 6, 2013 at 10:10 PM, Bob Weinand <bobwei9@hotmail.com> wrote: > >> Hi! >> >> As this seem to require a RFC, here is it: >> >> https://wiki.php.net/rfc/unset_bool >> >> Please feedback, >> >> Bob Weinand >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > unset is not a function, but a language construct, and there is at least > one similar construct which doesn't return anything (eg. not returning > NULL, but syntax error when used in a return context): echo > >
referring to "This removes also an inconsistency: the function's return value is void, states the docs. It is until now the only function which has no return value." especially.
-- Ferenc Kovács @Tyr43l - http://tyrael.hu

Will Fitch

13 years ago
On Wed, Mar 6, 2013 at 4:40 PM, Ferenc Kovacs <tyra3l@gmail.com> wrote:
> On Wed, Mar 6, 2013 at 10:38 PM, Ferenc Kovacs <tyra3l@gmail.com> wrote: > > > > > > > > > On Wed, Mar 6, 2013 at 10:10 PM, Bob Weinand <bobwei9@hotmail.com> > wrote: > > > >> Hi! > >> > >> As this seem to require a RFC, here is it: > >> > >> https://wiki.php.net/rfc/unset_bool > >> > >> Please feedback, > >> > >> Bob Weinand > >> > >> -- > >> PHP Internals - PHP Runtime Development Mailing List > >> To unsubscribe, visit: http://www.php.net/unsub.php > >> > >> > > unset is not a function, but a language construct, and there is at least > > one similar construct which doesn't return anything (eg. not returning > > NULL, but syntax error when used in a return context): echo > > > > > referring to "This removes also an inconsistency: the function's return > value is void, states the docs. It is until now the only function which has > no return value." especially. >
Agreed. The RFC needs to be updated as to not mislead readers.

Will Fitch

13 years ago
On Wed, Mar 6, 2013 at 4:10 PM, Bob Weinand <bobwei9@hotmail.com> wrote:
> Hi! > > As this seem to require a RFC, here is it: > > https://wiki.php.net/rfc/unset_bool
I'm not a fan of this change, but if it's going to be discussed, the RFC should include baseline and RFC change benchmarks.