Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105591 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 31323 invoked from network); 4 May 2019 19:05:16 -0000 Received: from unknown (HELO mail-pf1-f170.google.com) (209.85.210.170) by pb1.pair.com with SMTP; 4 May 2019 19:05:16 -0000 Received: by mail-pf1-f170.google.com with SMTP id e67so4450792pfe.10 for ; Sat, 04 May 2019 09:08:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ofsV9EE9/fVItJevgZa0Rv/K5hoEItqd/b4uK6umPQc=; b=PkDNyWxeFbIYj6+BGv75cOfDsJX/LPVeZewW7p7KreYCfnRzG35U68vxBg0QAtcDln CJrhWU+MYZheLaJeX6bfNIu/8TWoNsxnDgdtgdE5/c6dYg7HNdfGHkqXHjxyQtNQc/x8 kG9m8bXKC+irtkfoVrMKM083qNzrHQz5rhoNODNOR0Jv9infLukygPTwvysvRW5BJXSj qHK2Rzff19DDt9T5cdhyzAGFV8L5WnMrFuAH9zF+m8rwz/y+xJxL0UudNitwmMhi/ZDA BfmQM0giM0vQKHI8NCRUP4NHCwFbghDHptw6mSbJUDotHI/xxyqXuxjDOPz9wYo7/n4q VCFw== X-Gm-Message-State: APjAAAWFEVrgTtb59MYgnSHj9oeBsl79ueRgvqpQ+mfWELaKz7GLTiBS Mp8c5q57KV+zrHHSM/Oyx5v3G2XfE+J9cxaVY14= X-Google-Smtp-Source: APXvYqxCIvobF1FcvWiblB6MDy3X7fWo9ghbEOajNUWuFsoL0nqHFngILgwKdaqkoFe5+5KCy06vcczUEeScf9hjAPo= X-Received: by 2002:a62:fb16:: with SMTP id x22mr20436246pfm.140.1556986106931; Sat, 04 May 2019 09:08:26 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sat, 4 May 2019 19:08:15 +0300 Message-ID: To: Steven Wade Cc: Internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Proposal for a RFC From: kalle@php.net (Kalle Sommer Nielsen) Hi Den l=C3=B8r. 4. maj 2019 kl. 17.58 skrev Steven Wade : > > Hi Internals team! > > I have an idea for a feature that I'd love to see in the language one day= and wanted to run the idea by you all. > > The idea is to add a new magic method "__toArray()" that would allow a de= veloper to specifiy how a class is cast to an array. The idea is the same m= entality of __toString(), but, for arrays. While this sounds great and all, I do wonder about the implications it may have on the already existing behavior of type casting an object into an array which returns current public/protected/private property values. While this functionality is not an ideal or by design, it is fairly heavily (ab-)used, meaning that it is a potential BC break without the ability to an alternative. See this example: https://3v4l.org/ONMoi --=20 regards, Kalle Sommer Nielsen kalle@php.net