Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107275 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 70203 invoked from network); 21 Sep 2019 12:45:21 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 21 Sep 2019 12:45:21 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id D82512D201A for ; Sat, 21 Sep 2019 03:23:27 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Virus: No Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Sat, 21 Sep 2019 03:23:26 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id t10so4370636plr.8 for ; Sat, 21 Sep 2019 03:23:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=basereality-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=w3l+125nPAwf4xMg7g/GXtN0F1Sw7LdFw4tKVncwV3k=; b=j98V6Lm7z94i8DOxSDgfzScPeJVCjJGc7Eau/SZSsnVAVk9OrRQl0GDbDljZ2/KtSx EqRS7+g+ooiVgdxunAwdqAOpLdden3r6YMtEca+OCne3au65ygXHslt41znQKC0joeVk dO3yF1pAqS/GpBEZileRAoGYn46wgxYlDD8t7jnbirly4uAMQFrXQA84vwSR8CI5i9FP lj/jkk9Fe9auxsWnoQovXi3fxaZlB7mBs798pJMdlePDNo2ACXTr5Wgt7YdlfRRBf2Po BNEQWZSUQkl++yyQXvUPVA5r0pvNymYGg9nkpXzmBR+7iOCE5qt0hhv+6wmkSAkTIDAW 5gZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=w3l+125nPAwf4xMg7g/GXtN0F1Sw7LdFw4tKVncwV3k=; b=faCQaVNGDWmaYOMH95RXJnO196gbLbwV0yq3yeDHy4SrsnPt8U128OZXQgRK64bRWU C1rTqGSe2ptVbO7fQ6VmVBRnm1Hi7zXdIxNBPSsrWuVl0tHq/+VmbNCZoRQf9gfkCJ5E yHbgvffneOpnjqiQO9cs6uqkjSwANc4xRj7NuzxwH9EP3RJGC/SGmiUeoXgcct2Zp5G/ t1YJFXTzoWQMo0nh7PYRbQdobBUEDUB09Pwpt7T5lj6KzDyWOGcX7vxnI/AqMSQ7QqgI 2P+7nWzqT0US26GSOkL3sCQTVoWLUyCLQxjC7yf3fUoB5VIx6oTgmrMXnQXqlhVZEy1X bK+w== X-Gm-Message-State: APjAAAXkrpK5FG/VQi9gct0KdNFbsaXF8JNK997mCxqoFLAzR6qkyc6T Y6aBADQMW36zguc4l44WXg4lvbbhvvh1tT9HjtZWCQ== X-Google-Smtp-Source: APXvYqyTK6nUC7t20TbmddLZA6L+ygldQIvpgzaWZjQ7557r6GgtTVYnDynsrKwB2RSiCLB5bk43RQE576WQ4FJRB5E= X-Received: by 2002:a17:902:421:: with SMTP id 30mr22267228ple.105.1569061405753; Sat, 21 Sep 2019 03:23:25 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sat, 21 Sep 2019 11:23:15 +0100 Message-ID: To: Kosit Supanyo Cc: PHP internals Content-Type: text/plain; charset="UTF-8" X-Envelope-From: Subject: Re: [PHP-DEV] Question about `global` variable declaration From: Danack@basereality.com (Dan Ackroyd) Hi Kosit, On Sat, 21 Sep 2019 at 10:56, Kosit Supanyo wrote: > > global $$x; > global $$$y; > global $$$$z; > global ${'abc'}; > global $$$$$$$$$${random_int(0, PHP_INT_MAX)}; I have found the form `global ${'abc'};` useful in the past to work around the limits on what PHP can parse as variable names, to allow naming global settings to match how I like to write them in config files e.g. 'image.upload.retry_attempts'. I would be very surprised if there was no codebase in existence that didn't use the other forms, for better or worse. > If not, should this be changed to ... For changes like this, the conversation almost certainly needs to start by stating a clear problem something is causing, and then lead on to why doing a suggested solution is the right thing to do. Although this might be a small inconsistency in the language, by itself, I can't see it causing much harm, except maybe for performance optimisation as trying to analyze what variables are being used in the code is hard. cheers Dan Ack