Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105592 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 33143 invoked from network); 4 May 2019 19:07:36 -0000 Received: from unknown (HELO mail-qt1-f179.google.com) (209.85.160.179) by pb1.pair.com with SMTP; 4 May 2019 19:07:36 -0000 Received: by mail-qt1-f179.google.com with SMTP id k24so6415740qtq.7 for ; Sat, 04 May 2019 09:10:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=9WC3M+wyNVesYTS2SVbiVIACvTycakC6prHsEHw0a9E=; b=vEGkazO4j+y1BHfs3TRwqkJgoOL4D1m1J8o6hqH9XzM71z+PwuboP/IBptgOFI6EI+ Wx7aXZPXtJtyc1nj/KJrs7NIWApvS1zMKE3iokKJvKVHpKQOGc4qW8vNZUyJ4xy+ysqs b4i1mg+uQRgcSQFeAeHzTaXBeeKJafPHIAqRICRyPQ+MZ0Xf/4dDZPEhZ1ta7mo2Fo8q 64UxSLk39B8BFOgy89YuUpArWD2HPk/dxPPyXR3UN/UTxtnNvqijv0ZGxefOdjCZViWE RdqZLpsDE1RcmWUaDRgTmaswrUeXA9hWVhx5MYsvOLYN0w9rY+DQnUFMJ1wmZzoMQTlD AXhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=9WC3M+wyNVesYTS2SVbiVIACvTycakC6prHsEHw0a9E=; b=Qf97ik5+rzVfYuKlqG1WEYEFLM0bNpXjbwjQJ/RMUBukBE8b0AZCXvJ2Woi0pjoy0r TgbKnxullyqhVV8qnEziNV0h42+kWVW/TlfVKE9K8SLqTvFK6B2REx8Mx3uT7AdCVMtG FX5pnNSj3SH87+IDs+BZbu9OoGflcE5Qnow/NqWhlEUgybImhCDnwv2i/77YxEHDZG1b cgoJMBoJYnuXX365qh+HpMz362RXs82TQ3QDpN2fdd/sDnx5jXag7cPFFh/xBRWtbVag 272kI7VSh7y4ortgcFVJJ9HMfLH5T9BZt1Ms+9u0iXxeQiJPqMCy7yJEkHpWD/nUyFYQ yoow== X-Gm-Message-State: APjAAAUIEVSLAJWUyus0xgxMjByxOzlqdR1VyNR8OPj1lIkh367USHjv C/6cWEEkVzD0Lj8iKivMXdI= X-Google-Smtp-Source: APXvYqzraFqq4xxpEGRacPj+XsPWGsTtmf48BcbbSzSDiHa+k/kRyvZ2JABxsKJqmUg0EAZ9r2Vazw== X-Received: by 2002:ac8:28d0:: with SMTP id j16mr14128678qtj.15.1556986247223; Sat, 04 May 2019 09:10:47 -0700 (PDT) Received: from [192.168.2.59] ([96.69.104.182]) by smtp.gmail.com with ESMTPSA id j123sm3039538qkf.23.2019.05.04.09.10.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 May 2019 09:10:46 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) In-Reply-To: Date: Sat, 4 May 2019 11:10:45 -0500 Cc: Steven Wade , Internals Content-Transfer-Encoding: quoted-printable Message-ID: References: To: Kalle Sommer Nielsen X-Mailer: Apple Mail (2.3445.9.1) Subject: Re: [PHP-DEV] Proposal for a RFC From: pmjones88@gmail.com (Paul Jones) > On May 4, 2019, at 11:08, Kalle Sommer Nielsen wrote: >=20 > Hi >=20 > Den l=C3=B8r. 4. maj 2019 kl. 17.58 skrev Steven Wade = : >>=20 >> Hi Internals team! >>=20 >> 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. >>=20 >> The idea is to add a new magic method "__toArray()" that would allow = a developer to specifiy how a class is cast to an array. The idea is the = same mentality of __toString(), but, for arrays. >=20 > 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. I find it easy to imagine that objects not implementing __toArray() = would continue to exhibit that behavior. --=20 Paul M. Jones pmjones@pmjones.io http://paul-m-jones.com Modernizing Legacy Applications in PHP https://leanpub.com/mlaphp Solving the N+1 Problem in PHP https://leanpub.com/sn1php