Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21585 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53980 invoked by uid 1010); 19 Jan 2006 20:45:33 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 53965 invoked from network); 19 Jan 2006 20:45:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jan 2006 20:45:33 -0000 X-Host-Fingerprint: 64.233.184.204 wproxy.gmail.com Linux 2.4/2.6 Received: from ([64.233.184.204:4908] helo=wproxy.gmail.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id A0/5B-03850-D6AFFC34 for ; Thu, 19 Jan 2006 15:45:33 -0500 Received: by wproxy.gmail.com with SMTP id i13so320319wra for ; Thu, 19 Jan 2006 12:45:30 -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=iFFlVhLStWvJRO1R50vpIZSOtnZ+b+HeHITKm/70sf9KToKa5oHoTMMhOzNUE5+EJ3uKdhp9zH+FxQd3csK4exGlhtD4hDohRIOOAjLU4SdiNb3gjAGb6s7N5UQtMrga/lPUqYCL/i+Us+iDT0RLu6spBiChU9rlT04kg7GE5fo= Received: by 10.64.53.8 with SMTP id b8mr662018qba; Thu, 19 Jan 2006 12:45:27 -0800 (PST) Received: by 10.65.110.14 with HTTP; Thu, 19 Jan 2006 12:45:26 -0800 (PST) Message-ID: Date: Thu, 19 Jan 2006 22:45:26 +0200 To: Jani Taskinen Cc: internals@lists.php.net In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_10665_30305500.1137703526544" 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_10665_30305500.1137703526544 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sorry Jani, i mean a reference (alias) :) -- Marco 2006/1/19, Jani Taskinen : > > > For the 2nd time: references ARE NOT POINTERS! :-p > > --Jani > > > On Thu, 19 Jan 2006, Marco Kaiser wrote: > > > 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 > > > > -- > Give me your money at @ > Donating money may make me happier and friendlier for a limited period! > Death to all 4 letter abbreviations starting with P! > -- Marco Kaiser ------=_Part_10665_30305500.1137703526544--