Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21583 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37164 invoked by uid 1010); 19 Jan 2006 20:09:51 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 37149 invoked from network); 19 Jan 2006 20:09:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jan 2006 20:09:51 -0000 X-Host-Fingerprint: 64.233.184.198 wproxy.gmail.com Linux 2.4/2.6 Received: from ([64.233.184.198:10477] helo=wproxy.gmail.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 2F/29-03850-D02FFC34 for ; Thu, 19 Jan 2006 15:09:49 -0500 Received: by wproxy.gmail.com with SMTP id i13so312045wra for ; Thu, 19 Jan 2006 12:09:46 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=huNstwjxu3DzzFBnB2ZCsztsTFzQzDQvXVyXCm5tXX1Qk66MrDCa+ffj9gj0Krpd0eIGZIVfoSM4QqGdsgnfOBxPyGlTqaMtLJmefTe1CM5aV654/vxEY3DgiJSE1VsHJxM34WuRrDtMWnBvKbm6S/V5xqOloA67KU/vJjl+z0U= Received: by 10.65.243.17 with SMTP id v17mr820874qbr; Thu, 19 Jan 2006 12:09:45 -0800 (PST) Received: by 10.65.110.14 with HTTP; Thu, 19 Jan 2006 12:09:45 -0800 (PST) Message-ID: Date: Thu, 19 Jan 2006 22:09:45 +0200 To: Marcus Boerger Cc: internals@lists.php.net In-Reply-To: <1855654224.20060119205358@marcus-boerger.de> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_9989_13858969.1137701385596" References: <1855654224.20060119205358@marcus-boerger.de> Subject: Re: [PHP-DEV] 23 nothing is so as it seems, but why From: marco.kaiser@gmail.com (Marco Kaiser) ------=_Part_9989_13858969.1137701385596 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hmm yes i know this, but its very interesting for me to see how php internaly handles ++$a with = a pointer. Now i understand it :) -- Marco 2006/1/19, Marcus Boerger : > > Hello Marco, > > though Hartmut is perfectly correct in his statement here's what > happens: > > $a =3D 10; // 10 > ++$a // 11 > $a + $a // 22 > $a++ // 23 > > Thursday, January 19, 2006, 5:41:17 PM, you wrote: > > > Today during a session i had a strange "magic" feature found in php. > > > > $a =3D 10; > > echo ++$a + $a++; > ?>> > > just to verfiy echo $a after your echo line, it will show 12 > > > this works perfect as expected. it returns 22. > > but if i assign $a as a ref. to another variable it will be return 23. > > > > $a =3D 10; > > $b =3D &$a; > > echo ++$a + $a++; > ?>> > > > this will gave me to 23 > > (used the $b to the pre post stuff) > > > > $a =3D 10; > > $b =3D &$a; > > echo ++$b + $b++; > ?>> > > > this just happens if i have a ref. count to my var. WHY? :) > > > http://en.wikipedia.org/wiki/23_%28film%29 > > > -- > > Marco Kaiser > > > > Best regards, > Marcus > > -- Marco Kaiser ------=_Part_9989_13858969.1137701385596--