Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78801 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12844 invoked from network); 6 Nov 2014 09:30:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Nov 2014 09:30:03 -0000 Authentication-Results: pb1.pair.com header.from=drgomesp@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=drgomesp@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.171 as permitted sender) X-PHP-List-Original-Sender: drgomesp@gmail.com X-Host-Fingerprint: 209.85.212.171 mail-wi0-f171.google.com Received: from [209.85.212.171] ([209.85.212.171:49964] helo=mail-wi0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6C/8F-28384-99F3B545 for ; Thu, 06 Nov 2014 04:30:02 -0500 Received: by mail-wi0-f171.google.com with SMTP id r20so856089wiv.10 for ; Thu, 06 Nov 2014 01:29:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=WL3ECG2Xx3yYeN0UFmBAR7PgxDEzA4GuNYL2jfyU/Fc=; b=NyqMPRxsx3FI02Ry0ACml88MXXKzSdZWYXdz5O7OKxMGCFmyyLVlJ5BB723um9QwgT G3zJLMzRo402GpWtPdnHIy7RARUPv+SEwQXeMNHYMcHgSq2OL6+JK8G4N+2PP2BE2kNG CQn61yLnnPD6dXqduXIaIULH/omWF5koYd4EHuwH4vBVAvaNIPe4iyIrKZ3UBzu9nf4B 6imTQQJPZT4D8NFMsjgfc82zx5BE3WnhBz+yd0oD8CYaByU2eQz5FnPbNPjM+7yweMmQ pLdxx1NMpJ3hBJKVSTW/907i1nGTahgYxCKvK53IIahYjbZpzmcMNqlU3A5NU/yr/Kyo bTJw== X-Received: by 10.180.88.102 with SMTP id bf6mr38577878wib.43.1415266198870; Thu, 06 Nov 2014 01:29:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.39.201 with HTTP; Thu, 6 Nov 2014 01:29:37 -0800 (PST) In-Reply-To: <545B3900.6070208@sugarcrm.com> References: <545B3900.6070208@sugarcrm.com> Date: Thu, 6 Nov 2014 13:29:37 +0400 Message-ID: To: Stas Malyshev Cc: PHP internals Content-Type: multipart/alternative; boundary=f46d04428ab20be39a05072d5766 Subject: Re: [PHP-DEV] Allow arbitrary expressions when using instanceof operator From: drgomesp@gmail.com (Daniel Ribeiro) --f46d04428ab20be39a05072d5766 Content-Type: text/plain; charset=UTF-8 On Thu, Nov 6, 2014 at 1:01 PM, Stas Malyshev wrote: > You could of course require the expression to always be enclosed in (), > but that produces weird syntax where some forms of instanceof work > without () and some only with (). Given that you can easily assign your > value to a variable, is it worth it? > > Also, you can always use is_a($foo, $bar->getClassName()). > This is exactly what I'm doing right now, requiring the expression to always be enclosed in parenthesis. I think it's way better to be able to do this instead of creating temporary variables just to assign a class name. Also, is_a, since it's a function, is significantly slower than instanceof, which is a construct (but of course you already now that). Daniel Ribeiro http://danielribeiro.org --f46d04428ab20be39a05072d5766--