Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126701 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 qa.php.net (Postfix) with ESMTPS id 18ED91A00BC for ; Mon, 10 Mar 2025 21:53:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1741643462; bh=GaT62FSeY8pLaslvNtnYnMuuVOHPJSlGmwpR3CIxGaE=; h=References:In-Reply-To:From:Date:Subject:To:From; b=EdxQ8MSG2v8+CkLgsL0QKT8hXaWeuxIIHqAh1q1LeG442u1b6jyZnvU3i1N12pGX1 nLQ65EOYpQe4Sd5YTC0TCjYp4uUMrNtrqTCQSAiqsJ18hgYVvIslgmK3hXkmyUQEoO RjkAsRpLZrQEBPrGC9hgoIqsnBGxGXrfYKYuO7j+HB5gvgjQLyf6d3Jc49I+606gfH B/QZDpc5WTKtTm50b7UvYZnheXpMnm2EuV5ESdiSNomfhCR2YmOHW7VFa6DqfOrmoE t/Cmp3FYNNJ/TM+3Sb36HXq8aWy2y4e7V4UpRYGgye9j9I4HOp0GOyxI2AY1oYQbec TUfYS9Z1IbuyA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B4DD218006A for ; Mon, 10 Mar 2025 21:51:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) (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 ; Mon, 10 Mar 2025 21:51:01 +0000 (UTC) Received: by mail-qv1-f42.google.com with SMTP id 6a1803df08f44-6e86b92d3b0so37580106d6.2 for ; Mon, 10 Mar 2025 14:53:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741643615; x=1742248415; darn=lists.php.net; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=GaT62FSeY8pLaslvNtnYnMuuVOHPJSlGmwpR3CIxGaE=; b=H4P0gJTRzWpzo7ibVjgq9Mb+5+9DmMpNVEC9lxQPyr5jj5Xf/VfxiLfTN2FnaAKDrG 0QHcQ2+SC8kY1orYqI1rkG5/sRd9ecEUqbIjBeXefrhNa8ON5B9iML4F/cZX+QLPfrFF ajaC/ydCukT+kh3tvJS/40O3glLbunf/44Nvc/k12mLhCdIiJXwuW2pmsRUzNmp+jmeA pO8B4dwoUWrQi4CWPPBKV4yT1dYLRz22rc//o2tr8P1rIzGWNgn7qShvkN7Oih+G9XDA lCr6SaRPEH8pMkd7UFfyqpYlale7YZpLsHyCKIzdsVFuIiVE3+f/eSkWObKvQ4WqSvtw UzPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741643615; x=1742248415; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GaT62FSeY8pLaslvNtnYnMuuVOHPJSlGmwpR3CIxGaE=; b=wFody+f92MWCQi/Ccj5cecAZsDyWZqGYROmrwYyTjS2CrJiKd5+Tz9krvMAQ6lQ8Im URAoE0TJiD056hWW8yY7mnzs7dm9Z5zE5Rm6z0zG4aj2RDuAumOPTTkV09ZnE/Ji4GAL cX+Jmlw2JD7cO56Wmms6fgZL9l1zjDhjaRornEWIt/rUmaLoGQTF8rboJkcgpFtMde8L a5XkoCbUqArWZ8vgD8Ev/RkG45ipVj39XCCOeNpHxQCLGNUgxJZ2xWNbHhX9Wx7BdUA2 53CFm6BKbzp40eF7YPFnCuqOI16Nuy5EvVMeqOAJoc+2UqZPStfWakmBNjRvoQdG67av fomw== X-Gm-Message-State: AOJu0Yy28P7JPon40kraTAF2nU0pR+EuLA0EZ8qMrY+2MkcmVnDLhY/B kEBuPeB6dJZD2+s/k2hpaSn8BI1/FpS0ZyAzJa35H62pNCtX6HQewB7MkzB1BzDg1CDtdCD5h7r 2QsXBaHbav+dICkUckKXaOf9msOn3swRX/7Y= X-Gm-Gg: ASbGncsCPdq787tMDlNCHV8gt/YdBnC9+wQ80Pytbzo6GeLXvsIESgQ3ZJolIhJf5Y/ wbwdmHxG/aoMfnt8yTnkdEeRw4q74pO4gYrXxdlhUSRT5WxeWP3vG7ftukYpga7tKVcjQ/our1I YXVBYYiAd8NnlgqM1GXsFpKxE+bKr9gKfdY4gY9GBMRHxi+gQ8y1abugk+PbQC X-Google-Smtp-Source: AGHT+IG3LGXPc4YcMFApFcq1sB1JEdFl9FzZPUGgyoljfkWI+J8dMqsJ11NQNCeE4SVefoNPwv6R7PCAG4xgQ+ZjiqE= X-Received: by 2002:a05:6214:5188:b0:6d9:3016:d101 with SMTP id 6a1803df08f44-6e9006d9003mr199140656d6.41.1741643614934; Mon, 10 Mar 2025 14:53:34 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 10 Mar 2025 22:53:24 +0100 X-Gm-Features: AQ5f1Jqfog1d3Cbfl8vXHP7wmsVdM9lLdz74VZ55dOpJgbg9yaqVKXNpB88SUGs Message-ID: Subject: Re: [PHP-DEV] Manual unset and GC To: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: tovilo.ilija@gmail.com (Ilija Tovilo) Hi Vinicius On Mon, Mar 10, 2025 at 5:15=E2=80=AFPM Vinicius Dias wrote: > > > TL;DR: Does setting a variable to `null` (or even `unset`ing it) have *= *any** effect if that's the last instruction of a function? As others have pointed out, it is _almost_ completely unobservable. There are two small differences: 1. When the variable is a reference, $var =3D null; will write null to the reference, rather than the variable. The "out of scope cleanup" would be closer to an unset() rather than =3D null. 2. =3D null / unset() runs destructors in the scope of the child, while the cleanup on function exit executes in the parent scope. https://3v4l.org/obAgg But in terms of garbage collection, there's no value that would be cleaned up with an explicit unset() that wouldn't also be cleaned up when leaving the function. The arguments from your co-workers seem to rely on a faulty understanding of the engine. Ilija