Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53964 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84084 invoked from network); 14 Jul 2011 21:09:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jul 2011 21:09:51 -0000 Authentication-Results: pb1.pair.com header.from=rumi.kg@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rumi.kg@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.170 as permitted sender) X-PHP-List-Original-Sender: rumi.kg@gmail.com X-Host-Fingerprint: 209.85.220.170 mail-vx0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:34003] helo=mail-vx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/00-17830-F1B5F1E4 for ; Thu, 14 Jul 2011 17:09:51 -0400 Received: by vxi39 with SMTP id 39so552267vxi.29 for ; Thu, 14 Jul 2011 14:09:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=3gYxEJfaJjior9lpH8doxonWyPJMH1AEcAKI6DYGhGs=; b=RagcIvXayy2coZlBI++VxF8PwJwXQSKscpLONeFNU5pI61tXCZmgCVNmG7fkJKi6Bh kFj7hcWsNVWWYf6llFC/ACOucDzJFQBQtnJG+QOS5NhQppXxo54Q47+bA43fFXWApkZM GasY99WUb36dJ8mBEt6lt+6+n+F38B6BtVcx4= MIME-Version: 1.0 Received: by 10.52.88.199 with SMTP id bi7mr3071912vdb.108.1310677407610; Thu, 14 Jul 2011 14:03:27 -0700 (PDT) Received: by 10.52.165.67 with HTTP; Thu, 14 Jul 2011 14:03:27 -0700 (PDT) In-Reply-To: <950e6f2974cb87faa7b2745ddfd8bc15@mohiva.com> References: <67f900ce904612afdba7650ccbed6ed4@mohiva.com> <4ec16f049f8a5946bca7e81ecec50b45@mohiva.com> <950e6f2974cb87faa7b2745ddfd8bc15@mohiva.com> Date: Thu, 14 Jul 2011 23:03:27 +0200 Message-ID: To: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Re: $arr = array('Hello', 'world'); $arr(); From: rumi.kg@gmail.com (Rune Kaagaard) Will this work: array('foo', 'bar')('arg1', 'arg2') ? On Wed, Jun 8, 2011 at 3:48 PM, Christian Kaps wrote: > On Wed, 8 Jun 2011 15:39:59 +0200, Jordi Boggiano wrote: >> >> On Wed, Jun 8, 2011 at 2:46 PM, Felipe Pena wrote: >>> >>> class foo { >>> =A0 public function __construct() { >>> =A0 =A0 =A0$this->bar =3D function () { return 1; }; >>> =A0 =A0 =A0// $this->bar(); // error >>> =A0 =A0 =A0$x =3D $this->bar; >>> =A0 =A0 =A0$x(); // ok >>> >>> =A0 =A0 =A0$this->bar =3D array($this, 'baz'); >>> =A0 =A0 =A0// $this->bar(); // error >>> =A0 =A0 =A0$x =3D $this->bar; >>> =A0 =A0 =A0$x(); // ok >>> =A0 } >>> =A0 public function baz() { >>> =A0 =A0 =A0echo 'baz'; >>> =A0 =A0} >>> } >> >> What he meant was passing an existing method as a callback if you >> don't invoke it, i.e. passing "$this->bar" instead of array($this, >> "bar"). I don't know how hard it'd be to achieve, but it sounds pretty >> awesome to me. >> >> Cheers > > Yep, just what I meant. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >