Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126988 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 1C43E1A00BC for ; Mon, 31 Mar 2025 21:47:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1743457472; bh=X85RzB3XOWKnGHWZkqiVi6xb0X/5wrzHbOdLaUAB48M=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=fg6NQsgw6Dl95xfvd2/XLpQyLyjZDcxmMhbUtTZuPnm47jtqR3BblLLw1Cn9tVNch 7RLLhRKq1d1Mcmlj5lMXJkzaWoMQCjpzn8Uu4W2wx3ufA7sbfb1lGLUBaj09/6SIMz isSRP2fp5kGyTHRD6UKDnIbQSbpSh7CBy2+bpF5eO6utQ+P4il56IMmtvqoP2qYoL2 NGsHzYMofZq3W/Fp+zb0X6oGsjqC6u/xnLQstA00a7W8WvtY8icd6OzHCZJxVkBN2Y tgsdk54okmkwaaLvZd5dBnTh0FCSDb4t2n9M3z8wit/50zSqCz4W1HSSnkOM9OiO+E gfIRQ3rLJ/Qpw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 05AAE180080 for ; Mon, 31 Mar 2025 21:44:32 +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=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (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, 31 Mar 2025 21:44:31 +0000 (UTC) Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-301918a4e3bso8460752a91.3 for ; Mon, 31 Mar 2025 14:46:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743457618; x=1744062418; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=BBDLEHib9zqoVv4vom6v1Sv9l0V3JId1j3urrxguJLQ=; b=YPM3jMbocgDEqeoZYEiK26g1ywT+vCgFO5smuTMYIzMpcQvR7EVVwaFFrtsWdardjj I9DlqA80jLELt05VpYgK+7Q9cxaEU0n3MEbdtRh2M+ZkRWGwMUrmjo29VzwxBoBNe2Id 0O3mGrq4ER262GtMj1E3Oksj+VpVbJkFEv8ll3r5d9GuWQKGkOygh9iEgT9nG5vRo7x9 ORQ1K3pnpneN0tNIwr63CDKA0ks6PP+2M3hBtqpWOFo7ICRcqLnxn7ga/f6xbAjjxQEb fbZcZPbjZ69BULZG9GEGExPPXSSm/vdKLQUsY7y0f8ZrIphJ8Td6RrrSBFNQmIh2Hfox /TVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743457618; x=1744062418; h=cc: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=BBDLEHib9zqoVv4vom6v1Sv9l0V3JId1j3urrxguJLQ=; b=VZ60y821XtwoSjtf8Wv56DsebL+16QrhEwMPZjME955BggISj8UgzE/ulcwIo7FLaG fq386nJ8jUwsI2kdZyPs5lGgZLXtvaVjQIaHm3ISgZcd5hpNMe99RRRzwq2mUL9uQ+cl bVwYJ/r8UlvSYoO1FKRI11prHZllpODym43kpx7AFtA24bH6p3sOXsZwO03tkfezQHwF s8dced30meqHKZPA1i1KMetIJ5tNlJiybcODJ5fBx2nVWn+wOnVsKLKx6IkD0KYlYE2r Hog6ODARg8EJmEkVvVIMLP7O+T6vKvi53y/GD2tWEAwCfgAuLC4oa5BjLNTsCWPg/38a xQ6w== X-Gm-Message-State: AOJu0YyuH31VIWj3Ojuvd0vI5ZZDhxb05f3ebhpeI/L3e0WLNFqbqect qjT54yhHKkKgKXyR7p0+divqtqhomd+JJvVgVEJVzGWrXh9Mr++b7D7VmQSRkl4tYgI2o7+oet6 yPy2fDIaW4UsW0sVqoV/DDfok990= X-Gm-Gg: ASbGncu/pNXLustSxyJ2RqKGX5koKGBcPxXm0Ga/Swd69NtkJ2j/S//xtTmBU0F6cGP s5KEQtuDmAIGSD1MO+s0WFt9eVDMaW+Wlb74KS9pVCnQciBCeajhu33kXG11WjiKs+twSmf3VzH RFaj9O3qjdZAxTbO/ent+4E1o76rE= X-Google-Smtp-Source: AGHT+IHUgXNdszKkBxIdSaW35+O2Z+TpweUHca3YdcQILpfB9nLEfZDHLTsZ5PeG26N9CMDgE5PRyoX0RGrxbgLrZh8= X-Received: by 2002:a17:90b:264e:b0:2fa:137f:5c61 with SMTP id 98e67ed59e1d1-30531fa4e78mr19376955a91.12.1743457617701; Mon, 31 Mar 2025 14:46:57 -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, 31 Mar 2025 23:46:46 +0200 X-Gm-Features: AQ5f1Jqm3HO4vfGr8QDjyhMX_0PXqG3p3a5AwWqweajMvmMi8a647AXV9tNciNY Message-ID: Subject: Re: [PHP-DEV] Closure::getCurrent() for recursion To: Ilija Tovilo Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000fbf2860631aa5b85" From: jorg.sowa@gmail.com (Jorg Sowa) --000000000000fbf2860631aa5b85 Content-Type: text/plain; charset="UTF-8" Hello Ilija, Nice addition! I thought about edge cases and what the desired output is with nested closures? Example:
Hello Ilija,
Nice addi= tion! I thought about edge cases and what the desired output is with nested= closures?

Example:
<?
$a =3D function (int $numberA)= {
=C2=A0 =C2=A0 $b =3D function (int $numberB) {
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 if($numberB < 10) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 =C2= =A0=C2=A0 return Closure::current(10);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 return $numberB;
=C2=A0 =C2=A0 };
=C2=A0 = =C2=A0 return $b($numberA) + $numberA;
};

var_dump($a(4));
<= /div> --000000000000fbf2860631aa5b85--