Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66726 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18104 invoked from network); 20 Mar 2013 18:50:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2013 18:50:06 -0000 Authentication-Results: pb1.pair.com header.from=swhitemanlistens-software@cypressintegrated.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=swhitemanlistens-software@cypressintegrated.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain cypressintegrated.com designates 173.1.104.101 as permitted sender) X-PHP-List-Original-Sender: swhitemanlistens-software@cypressintegrated.com X-Host-Fingerprint: 173.1.104.101 rproxy2-b-iv.figureone.com Windows 2000 SP2+, XP SP1 (seldom 98 4.10.2222) Received: from [173.1.104.101] ([173.1.104.101:55162] helo=rproxy2-b-iv.figureone.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7E/EB-46127-DD40A415 for ; Wed, 20 Mar 2013 13:50:06 -0500 Received: from localhost ([216.220.114.66]) by rproxy2-b-iv.figureone.com (Brand New Heavy v1.0) with ASMTP id FVS84202 for ; Wed, 20 Mar 2013 11:50:02 -0700 Date: Wed, 20 Mar 2013 14:49:46 -0400 Reply-To: Sanford Whiteman X-Priority: 3 (Normal) Message-ID: <439380394.20130320144946@cypressintegrated.com> To: Carlos Rodrigues In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Method check - Can someone create a RFC for it? From: swhitemanlistens-software@cypressintegrated.com (Sanford Whiteman) > Create something like $foo->bar?() or $foo->bar()?, where you don't > care whether the function exists, or if $foo is an object. If it > doesn't exist you just return null. [1] Don't do this. [2] What everyone else said. [3] If you feel you must, this at least "colors within the lines" a bit more than '@' by forcing you to set a class as wildcard-able: class bitbucket { function __call($name,$arguments){ return "default value"; } function __get($name){ return new self; } } class myClass extends bitbucket {} $myInst = new MyClass; print $myInst->noExist->nexistePas(); // "default value" [4] Goto [1]. -- S.