Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99326 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96571 invoked from network); 2 Jun 2017 17:13:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jun 2017 17:13:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=tendoaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tendoaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.47 as permitted sender) X-PHP-List-Original-Sender: tendoaki@gmail.com X-Host-Fingerprint: 209.85.213.47 mail-vk0-f47.google.com Received: from [209.85.213.47] ([209.85.213.47:36503] helo=mail-vk0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E3/E8-12681-A9C91395 for ; Fri, 02 Jun 2017 13:12:58 -0400 Received: by mail-vk0-f47.google.com with SMTP id p85so43309919vkd.3 for ; Fri, 02 Jun 2017 10:12:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=ClxRmqfzGKxO3Ep/JBWQjDXD/69koR4+RmIikQ3T2c0=; b=sshQ1cfBiurMsl3FBf5P/2gSoBQubYQ36cGeVz1Crjjd0fUbEZGKLxjtOEpJE0vMl+ ++J+wbw73fjiVw/kg9YMHBvFXYLlPIMp7DFBbzr02abhk0+enikUatrukT8/82jYjs3Z eA9/SZyQ/BhXZ6Gl/g+/AQaF6kAuL9H127q8DgPyN1DMPSpekmYXoI+XAiEE444fRsZk gQrOQRJGGvmebOnK+9/pzG1dCC6OACZATxe3mTW0k0ho2RCKV3F6kPlhV9hdHRMzBlU0 yb+v5mLuVppquAwwBPhGRgsPZN06Md1jF7nJvFrIf7owAdy300v1zvh4II9KhmPn8n9M 8JOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=ClxRmqfzGKxO3Ep/JBWQjDXD/69koR4+RmIikQ3T2c0=; b=d+SsKMaM0NpBH15jvniqOGyuxbeu83A9NyhuqXaoJjIoS85Q12AClQuA4COizaYFMm tfRtMSUROcAlsei59N9SE0Q/tQ84fEFaC/KSqdZ+lwuRV2yCkOVGfWX+WUmWRv5RaAVZ Dg+0iun7QfKcDUbQCxCBSqCwg0EPtbWAk9PxVh8rVKKaJ7AMxgOsM+zkKPLJeN9W2bDp gMb5oda2Z/tU0W8snKD83cdRsEy4XqRu4NKeKcOxdk5cpBmo8Ddz/dE9Yx+NlDHtHKe9 ZQmg2St6dwtMuEnmIALkFZrhsky8BTN550voKJN3bVdj/7oVgFUXPA7kGmgBWPB4dsed n0lQ== X-Gm-Message-State: AODbwcDZo1nTXX/DXHIDlDfKejskOcxjKvAFkOzMivTGSnMAcotJvD5t g6cjMfDAgNINDMtmBxNkOxIdSryPLA== X-Received: by 10.31.11.203 with SMTP id 194mr3982687vkl.12.1496423575258; Fri, 02 Jun 2017 10:12:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.142.5 with HTTP; Fri, 2 Jun 2017 10:12:54 -0700 (PDT) In-Reply-To: <1496415412.4363.66.camel@schlueters.de> References: <1496415412.4363.66.camel@schlueters.de> Date: Fri, 2 Jun 2017 13:12:54 -0400 Message-ID: To: "internals@lists.php.net" Content-Type: multipart/alternative; boundary="001a11410e2aa30a510550fd43c5" Subject: Re: [PHP-DEV] RFC proposal From: tendoaki@gmail.com (Michael Morris) --001a11410e2aa30a510550fd43c5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable What about foreach by reference, which is honestly the only time I use referencing anymore... foreach ($array as $key =3D> &$value) { $value =3D someOp($value); } Is this also bad? On Fri, Jun 2, 2017 at 10:56 AM, Johannes Schl=C3=BCter wrote: > On Fr, 2017-06-02 at 15:21 +0200, Bart=C5=82omiej Krukowski wrote: > > Hello, > > > > PHP allows for using implicit references in arguments of function. In > > most common case we have to mark that variable is an reference in > > head of function, in other case we will receive fatal error (@see > > example - http://ideone.com/7zkgQQ ). There > > is an option to use variable as implicit reference (@see example - ht > > tp://ideone.com/T6oF7C ), I think it should > > not be possible. Only explicit references should be allowed (except > > objects). > > The argument to the function in the second value is an array which is > passed by value. A copy of the array keeps the references as > references. This is consistent. Unless we have typed arrays or anything > like that the function call shouldn't care about the content. > > Aside from that references are a legacy construct and shouldn't be used > anymore. Using objects or relying on copy-on-write usually leads to > clearer code, reduced memory and faster execution. (in the past there > had been a few exceptions where arrays of references were good for some > graphs/trees with recent improvements to objects this is less the case) > > johannes > > http://schlueters.de/blog/archives/125-Do-not-use-PHP-references.html > http://schlueters.de/blog/archives/141-References-and-foreach.html > http://schlueters.de/blog/archives/180-References-Still-bad-in-PHP-7.ht > ml > http://schlueters.de/blog/archives/181-More-on-references.html > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a11410e2aa30a510550fd43c5--