Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53213 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72774 invoked from network); 8 Jun 2011 13:48:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Jun 2011 13:48:40 -0000 Authentication-Results: pb1.pair.com header.from=christian.kaps@mohiva.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=christian.kaps@mohiva.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mohiva.com from 178.63.228.54 cause and error) X-PHP-List-Original-Sender: christian.kaps@mohiva.com X-Host-Fingerprint: 178.63.228.54 elvis.mohiva.com Linux 2.6 Received: from [178.63.228.54] ([178.63.228.54:55376] helo=elvis.mohiva.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 62/83-48516-7BD7FED4 for ; Wed, 08 Jun 2011 09:48:40 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by elvis.mohiva.com (Postfix) with ESMTP id 992491D24013 for ; Wed, 8 Jun 2011 15:48:36 +0200 (CEST) X-Virus-Scanned: amavisd-new at mohiva.com Received: from elvis.mohiva.com ([127.0.0.1]) by localhost (elvis.mohiva.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AOzmZjva+Gzh for ; Wed, 8 Jun 2011 15:48:35 +0200 (CEST) Received: from elvis.mohiva.com (elvis.mohiva.com [178.63.228.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: christian.kaps@mohiva.com) by elvis.mohiva.com (Postfix) with ESMTPSA id EDAAE1D24011 for ; Wed, 8 Jun 2011 15:48:34 +0200 (CEST) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Wed, 08 Jun 2011 15:48:34 +0200 To: In-Reply-To: References: <67f900ce904612afdba7650ccbed6ed4@mohiva.com> <4ec16f049f8a5946bca7e81ecec50b45@mohiva.com> Message-ID: <950e6f2974cb87faa7b2745ddfd8bc15@mohiva.com> X-Sender: christian.kaps@mohiva.com User-Agent: Roundcube Webmail/0.5.2 Subject: Re: [PHP-DEV] Re: $arr =?UTF-8?Q?=3D=20array=28=27Hello=27=2C=20?= =?UTF-8?Q?=27world=27=29=3B=20=24arr=28=29=3B?= From: christian.kaps@mohiva.com (Christian Kaps) 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 { >>   public function __construct() { >>      $this->bar = function () { return 1; }; >>      // $this->bar(); // error >>      $x = $this->bar; >>      $x(); // ok >> >>      $this->bar = array($this, 'baz'); >>      // $this->bar(); // error >>      $x = $this->bar; >>      $x(); // ok >>   } >>   public function baz() { >>      echo 'baz'; >>    } >> } > > 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.