Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99672 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3105 invoked from network); 29 Jun 2017 09:04:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jun 2017 09:04:56 -0000 Authentication-Results: pb1.pair.com header.from=lists@rhsoft.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=lists@rhsoft.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain rhsoft.net designates 91.118.73.15 as permitted sender) X-PHP-List-Original-Sender: lists@rhsoft.net X-Host-Fingerprint: 91.118.73.15 mail.thelounge.net Received: from [91.118.73.15] ([91.118.73.15:64123] helo=mail.thelounge.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A9/A8-07609-4B2C4595 for ; Thu, 29 Jun 2017 05:04:54 -0400 Received: from srv-rhsoft.rhsoft.net (Authenticated sender: h.reindl@thelounge.net) by mail.thelounge.net (THELOUNGE MTA) with ESMTPSA id 3wytym5ps9zXMl for ; Thu, 29 Jun 2017 11:04:48 +0200 (CEST) To: internals@lists.php.net References: Message-ID: Date: Thu, 29 Jun 2017 11:04:48 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-CH Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Final variables From: lists@rhsoft.net ("lists@rhsoft.net") Am 29.06.2017 um 04:50 schrieb Kalle Sommer Nielsen: > 2017-06-28 20:46 GMT+02:00 David Rodrigues : >> The "final" keyworks make a "local scope" variable value "blocked to >> rewrite" after instantiate it. >> Okay, it sounds like a "const", and it is, but "not as we known it". > > I get that, but I still don't understand why you would forcefully need > it to be a variable still then if you know the value is gonna be > constant, of course besides global visibility or in iterations because constants are expensive in PHP when "define()" is a function call and "const" is very limited for no good reason "no good reason" because if it really would be compile time the following won't work and so why can't you use 'const' within a if-statement when you in fact can CONCAT two with define() set constant which are part of a if-statement themself ____________________________________________________ if(PHP_SAPI !== 'cli') { define('MY_PHP_SELF', $_SERVER['SCRIPT_NAME']); define('rh_serverurl', PROTOCOL_PREFIX . MY_SERVER_NAME . $rh_port); } else { define('MY_PHP_SELF', '/' . basename($_SERVER['SCRIPT_NAME'])); define('rh_serverurl', 'http://localhost'); } const rh_phpself = rh_serverurl . MY_PHP_SELF;