Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129064 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 1E4E61A00BC for ; Tue, 4 Nov 2025 08:50:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1762246227; bh=qOUjAuTgNzELcG0cCF0sb5JgntJBcUBURMgAWJE7XCA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=BhdddvXxhBtH++ssClMKYYVjWj1vAuaEZtEimEI02KCPYM8NS7OtMMpyzLTeyjBen Fv0nY/lv2e+gLLIGIsMX46XgETqa9zi3/v2lXi0SgEITeLFIXR62WcgA0yIDznIZPY qWBkjvj9gJYtSzDe5q/Ha+kgPnC89Qg8uHHhkFiW2S5ZhZPJJfK0mKDP4wmgooZu8U GUq4KRYPVLiU6cO86w5wtD205YMQxX1aA2rbcEIfknU+aqyS29uNPyubAxTovtt65Q Hlb/YCFXgfLF7tc5E+MpwhLjdvSK2z0IVZomnwKEW5tT5fAuaFhzFBGU42wYMcnrLH eZwOOm2HTmqhQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 261D018005B for ; Tue, 4 Nov 2025 08:50:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 4 Nov 2025 08:50:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1762246220; bh=LIdifyQleWn52BGhG8XU1Gcc05AOCdwjj7gK8+xcVCQ=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=UWDjLShj/Rq+lfT7IV79K1ISugVXAWJULxsBoEGHqh4WAH77EQHI1qaBSM298nKOC FxgdwvLRO0R8IFMF3PEGbi1t3XUcE2Y9DzYVKKnmuf/xG3SdS3vF0pn2/t3G/KHYHh ajltZgjUc2hrC+3YrjvIBtpPjjCTE+nCqzGa2oP8CW576lOPE7KtY3oD8l1UNuZNVE glDfcEZU2rw+GRO4mJQydbSdfhtw/TyWYWBEIIMFqfJTU9ddMG0qi242YwkVgZAnKv ZFRtBW53vdsOzusoDR4AjHEX0xBKekWhTMWfhR9jkRbEQ1LZWD1QyuDTEV7mz+u9RO /MRUDjVb8jtzg== Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Date: Tue, 04 Nov 2025 09:50:19 +0100 To: Bruce Weirdan Cc: Seifeddine Gmati , internals@lists.php.net Subject: Re: [PHP-DEV] [RFC][Discussion] use construct (Block Scoping) In-Reply-To: References: Message-ID: <569e4b5f886b0fa2c205a0eae881105c@bastelstu.be> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi Am 2025-11-04 07:08, schrieb Bruce Weirdan: > What would happen to the variables introduced in the statements > block, rather than in `use()`? Will they still be available outside of > the > block? Yes. The construct only affects the variables listed in the “declaration list”. I have adjusted the “simple example” to introduce a new variable `$z` that is initially defined in the block, but not listed in the declaration list to make that clearer. > ```php > use () { > $number = 42; > } > var_dump($number); // what happens here? > ``` > > Also, is an empty list of vars in `use` (as in the example above) > allowed? That is a syntax error (unexpected `)`). Best regards Tim Düsterhus