Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91221 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62880 invoked from network); 12 Feb 2016 14:39:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Feb 2016 14:39:50 -0000 Authentication-Results: pb1.pair.com smtp.mail=ua.san.alex@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ua.san.alex@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.174 as permitted sender) X-PHP-List-Original-Sender: ua.san.alex@gmail.com X-Host-Fingerprint: 209.85.213.174 mail-ig0-f174.google.com Received: from [209.85.213.174] ([209.85.213.174:36141] helo=mail-ig0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FC/34-25203-4BEEDB65 for ; Fri, 12 Feb 2016 09:39:49 -0500 Received: by mail-ig0-f174.google.com with SMTP id xg9so10758035igb.1 for ; Fri, 12 Feb 2016 06:39:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=B+FzXilrhA0Gbvenej3bZYKRw7OoPX4n2cULVxBzIFs=; b=oilkTOFUr254O3RFr0CDT0Au9OrFsK+c7xlVRVTl7rWRInD+3k2kr2oJuRBceQ68Se MqXG+iohJdH5PilEVMRzVWGNAljiMmzE5j3F9vjtkjG7rkW/ro3jaP0eZrNp4MEjYXEz AC6ZXP/yrpSb/k7O3J9opIbkCvHWNUfgNJo2pQ6UxRXyIdn9jQNYcYdjQxkRftaT7ysE j6nzcI5IDFEwUPIW4Fo7p7GM93WFyDPuNArQfKl6zeoqg6UwcoIC7E0QZ43M1dGuhAXL CueVHeRccpld0SEw5jNSAbS+R5es+NsqYyJnzYpqkmvE537bSE0m35JBi87qml1x7oQ8 MHew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=B+FzXilrhA0Gbvenej3bZYKRw7OoPX4n2cULVxBzIFs=; b=GEbrewWOeCZJL9RQy/RKFNT9GdV8SdSLdnUbQMlf4MZgGTfGzEl8VyBilyzfP9FkQQ kx76NY73d1TaD5rBLxj5vJ8hrS1UVLuj5VhGXswUCRAzI1hW5WpFe///oWIt7p2m6MQR yOGzOhmZyBEwPWA01sMYkTIX+Coz2U0G/P+Z/KdOQS3ZnGNusCeiILL5Rq8WxIEe7zDC G0jtm4BBhMUcjLespYYkLbPH3Cs2TpvOOyA6+VmuvYuFcCuXccKBBZ9s9nBLpZsschVm EVD8wUTibqgJwYsX9TqWvBgMEYu04w36X1GvNZYZR8dbdK89VpGaf0PFbVPKWgJeiW2d 66SQ== X-Gm-Message-State: AG10YOSYOwLtMvP5mxR1QyhZAcAJMaQDtKUC6WkRNQ/xk4aq8L3r8ZBNLzS4vzqT3D2dMH4yRQwLIv1d/037/Q== MIME-Version: 1.0 X-Received: by 10.50.138.11 with SMTP id qm11mr3220807igb.45.1455287985499; Fri, 12 Feb 2016 06:39:45 -0800 (PST) Received: by 10.50.31.169 with HTTP; Fri, 12 Feb 2016 06:39:45 -0800 (PST) In-Reply-To: <56BDEBC8.4090806@gmail.com> References: <38.31.07203.2EB94B65@pb1.pair.com> <8E.1A.36326.338F8B65@pb1.pair.com> <56BDEBC8.4090806@gmail.com> Date: Fri, 12 Feb 2016 16:39:45 +0200 Message-ID: To: Rowan Collins Cc: internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC][VOTE] Allow specifying keys in list() From: ua.san.alex@gmail.com ("S.A.N") 2016-02-12 16:27 GMT+02:00 Rowan Collins : > S.A.N wrote on 12/02/2016 13:37: >> >> Often all keys are unknown, or a very lot keys, use list(...) - is unreal. >> >> I would like to, instead > >> foreach($params as $key => $value) >> { >> $this{$key} = $value >> } >> >> Use the short syntax sugar > >> $this += $params >> >> ?> >> >> It's really do? >> > > If the keys are unknown, then you probably don't want to blindly copy them > onto object properties; at that point, you might as well just have > $this->data and leave them as an array. It sounds like what you actually > want is an object literal syntax - i.e. $params should never have been an > array in the first place. > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > I would operator (+=) as like to function Object.assign() https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign