Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53018 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49790 invoked from network); 6 Jun 2011 13:22:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jun 2011 13:22:48 -0000 Authentication-Results: pb1.pair.com header.from=doctorrock83@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=doctorrock83@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: doctorrock83@gmail.com X-Host-Fingerprint: 209.85.220.170 mail-vx0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:64462] helo=mail-vx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F6/25-17923-7A4DCED4 for ; Mon, 06 Jun 2011 09:22:48 -0400 Received: by vxb40 with SMTP id 40so3080543vxb.29 for ; Mon, 06 Jun 2011 06:22:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:from :date:x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=RmCS0hWVgxB+XORXgn+ZYtkyVjxE6tJHSeBilMF6/bY=; b=nf59FnPFHXA+XW5mJ9oVOS526waQYGTjg6TXjklqK3RrVX97hESFjLO9to8SI4bdN0 iIEFfFN+yXiVMQOnpHFmRfUQydo3UzXwznd+QvtBNVY5HuWGgymt6nvInKcIzAk5S/xV FHT8rsqEjUw8BjLuhw9wRw59dT2SLjIG1Ct3I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=Z+kLR9vZNY91my3wYiBkjf2pdCuCGcUwy0Um772C9fjEd4WDcqJtUToAGlMCGC+c2n qUH6b9Qh3e/78CgH5netdrVDbn/DhjusP0Q2/N9rcvpYcNW+OlxjLsuliuhB1+fW3q9s ZofZfzYWU2WEXLLmqiNAsJB/0BK9/RRzAA7GA= Received: by 10.52.172.7 with SMTP id ay7mr6777903vdc.100.1307366565161; Mon, 06 Jun 2011 06:22:45 -0700 (PDT) MIME-Version: 1.0 Sender: doctorrock83@gmail.com Received: by 10.220.190.194 with HTTP; Mon, 6 Jun 2011 06:22:05 -0700 (PDT) In-Reply-To: <94A53E36-9F64-49B3-877A-C575CB2508AF@bitextender.com> References: <94A53E36-9F64-49B3-877A-C575CB2508AF@bitextender.com> Date: Mon, 6 Jun 2011 15:22:05 +0200 X-Google-Sender-Auth: 8LghY6lHD_DLFvpv3vKgBPMjyK0 Message-ID: To: =?ISO-8859-1?Q?David_Z=FClke?= Cc: Felipe Pena , internals Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr(); From: jpauli@php.net (Julien Pauli) +1 , nice job Julien On Mon, Jun 6, 2011 at 12:53 PM, David Z=FClke wrote: > <3 > > David > > > On 05.06.2011, at 17:52, Felipe Pena wrote: > >> Hi all, >> Reading our bug tracker I noticed a good feature request [1] from 2009 w= hich >> points to an interesting feature that I think makes sense for us, since = we >> are now working with $f() using objects and strings, and the array('clas= s', >> 'method') is an old known for call_user_func()-like functions. >> >> So, I wrote a patch [2] that allow such behavior to be consistent with >> arrays. See some examples: >> >> class Hello { >> =A0 public function world($x) { >> =A0 =A0 =A0echo "Hello, $x\n"; return $this; >> =A0 } >> } >> >> $f =3D array('Hello','world'); >> var_dump($f('you')); >> >> $f =3D array(new Hello, 'foo'); >> $f(); >> >> All such calls match with the call_user_func() behavior related to magic >> methods, static & non-static methods. >> >> The array to be a valid callback should be a 2-element array, and it mus= t be >> for the first element object/string and for the second string only. (jus= t >> like our zend_is_callable() check and opcodes related to init call) >> >> Any thoughts? >> >> [1] - http://bugs.php.net/bug.php?id=3D47160 >> [2] - http://felipe.ath.cx/diff/fr47160.diff >> phpt: http://felipe.ath.cx/diff/fr47160.phpt >> >> -- >> Regards, >> Felipe Pena > >