Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81415 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14996 invoked from network); 30 Jan 2015 10:16:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Jan 2015 10:16:45 -0000 Authentication-Results: pb1.pair.com header.from=martin.keckeis1@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=martin.keckeis1@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.43 as permitted sender) X-PHP-List-Original-Sender: martin.keckeis1@gmail.com X-Host-Fingerprint: 209.85.218.43 mail-oi0-f43.google.com Received: from [209.85.218.43] ([209.85.218.43:57426] helo=mail-oi0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8B/A3-31101-C0A5BC45 for ; Fri, 30 Jan 2015 05:16:45 -0500 Received: by mail-oi0-f43.google.com with SMTP id z81so34053844oif.2 for ; Fri, 30 Jan 2015 02:16:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=DKjt++QJV6Iukw1v68oeIndX+hLQo6k7f9RgQoAI/D0=; b=UvmOO8XzFpNvTa8ths5hvo+UXSsQpRRg5tY8ML4nqOr04dkvUhkuNz+97lkflzeq3L 89B7pgUyvyrwzcmlD1BsEVZhpuHG+LYkOB86xFfxnHJBPwvRR1Hya4inUTAD4IyE07uI PfruT4jl3ohSYh3glYM92a1Ks4rRJEvaJquSf/tlVfe6jVOFl0SDq/mTW5CP3GUrK9BH NtAFgxep81l0gM3qiyGBrsACVFTw3Lmst8a81pudNIppB7qV87py0vnad+C9vXplsMe2 F1+ImEfE/mXfKE44qrg9CDqblHwsUUaX9AEWp4AjUjpsaSO/qSRoURKt4O8glPqpRFv1 DA1g== MIME-Version: 1.0 X-Received: by 10.202.95.7 with SMTP id t7mr3093229oib.104.1422613001903; Fri, 30 Jan 2015 02:16:41 -0800 (PST) Received: by 10.202.232.139 with HTTP; Fri, 30 Jan 2015 02:16:41 -0800 (PST) In-Reply-To: <20150130093558.GC4250@phcomp.co.uk> References: <54CB13A4.9060900@rodas.me> <20150130093558.GC4250@phcomp.co.uk> Date: Fri, 30 Jan 2015 11:16:41 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary=001a113cdf70a1a4b4050ddbe6f2 Subject: Re: [PHP-DEV] Is it a good idea to have a "strict" mode? From: martin.keckeis1@gmail.com (Martin Keckeis) --001a113cdf70a1a4b4050ddbe6f2 Content-Type: text/plain; charset=UTF-8 > > You might get more approval for: declare(strict=1); > > I would like to see this to help catch typeos in variable names. If a > variable > is assigned and it does not already exist some sort of error would be > raised. > The inspiration of this is from Perl where 'use strict' does this. > > How to declare a variable ? The keyword 'var' exists, it is only used in > classes > but could be used to declare variables in functions and at the top level. > > Thus: > > declare(strict=1); > > var $foo; // Declared but not given a value - so give it NULL > var $bar = 1; > > $foo = 234; > > $baz = 10; // This would error - $baz is a typeo for $bar > > You can achieve that already quiet simple