Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122553 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 DA06C1AD8F6 for ; Mon, 4 Mar 2024 19:17:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1709579881; bh=YOVMDzSf5qzhgL9f5CmFAsKXNRaj8Gv4iWRWZnjetLA=; h=Date:Subject:To:References:From:In-Reply-To:From; b=XD0m+4656aRD6YXuiWX3WRSr6zTWUsAD7RAfnLZCk8yarA8FZhW68k8wStg0SLxQv 95ZXW/x2YH5lTT7d4Ah0imBAqXGaFZCeK9Pj1sJODysQmLNUfJRXhRnQ9lYW/1ZP/1 Zoz03CTM+0ybFedu3NXxmoSSpt8g5Gf27ECCQwHFIHmGKkNcS4zGO+I8Fq3bnDeOx0 K2iJHMDvz2Iq0t2qh/7XrVuBqePEfTLW2/mo/Emj+qI68mv4JuraXKdFRk4NMd316L MSx9lC7X9UJmnDWtXDwgDNBJUItv6MM8M8wRQDTBr8g5d9/NwcFyjeVTtJ1TXDT3ft CgA16vc8DTT+A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7880118003E for ; Mon, 4 Mar 2024 19:17:58 +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, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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, 4 Mar 2024 19:17:57 +0000 (UTC) Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-412e89372e1so5029695e9.3 for ; Mon, 04 Mar 2024 11:17:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709579862; x=1710184662; darn=lists.php.net; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=e4ZxmS2YvEFPT0GEYsN+kWIT4x4x3BHLelc/k0pYr3w=; b=Ln6ErPrgdi9xjI01ihHtOIULkZvBPAHeWBpApeQ/a38zUaGwdIXIWF2d3g554uA2hq ri2re+EjNLBdpnnwm6kSO0YROVM3yCLbgd3GG3vHnNdCPKWlhoTpGctKXM3pOqM2finR pxyP0xxFBwhj6MMxZ1XGcVGDsKmNGrZ3QiT1LFbc8paDvYZzIy9xYZN+QgFsnbJcyLau VBS6fK0XOmFSX4CvbBo91DFGozEZdfGIQXRLfkVraX0rbK7wToxdpBdiQW4srcvdF+gU emB5ZIu80I4fmPJsZwfciJj815QLion3zMizr2zGGlp9nNBU709GuvzaXcQ4NP1y6koU l9ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709579862; x=1710184662; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=e4ZxmS2YvEFPT0GEYsN+kWIT4x4x3BHLelc/k0pYr3w=; b=RozrAHk5MIAM0PKQVFLeOMn/1wvoEXuqjh89fcWi5xa1HRknRP1pwwVszVDbmgBuly p/8HdHjBYdIyqN76/V7BowpZXoUC172MvJokw8ogjzt2lFCBcFYSEclnGqD5zZLUgITm 9BnHyQDqfU23R7+P0WjOX2YNB6SmhLe/n7Sb6H9O24NZAlGBkR+SEV1H/xzJFwSKpUdz hN3zeypRQt9qxY+QzDo+4EOKs46IyOp+9pCwBYgl0oakjWqtpiaPyMl2qWbkFFrge5wA EZh5qbcUOgMzpLnKE4mhineUTU1oMbREBeLoi/zCwmqswCqHXOUC1/nybFf9XXZ79gjO qD+A== X-Gm-Message-State: AOJu0YzMVByUIvrFMKtMHIX6j4xTEbvkl4ILlbylr8+LZqdccsRk1xYs zk6lAW79Mo4gAtYgffIYnAcIudkEYM9HF90jZI3LQKw0owiPjCIrkYDL54TU X-Google-Smtp-Source: AGHT+IF8Zdb7SRAOFX4ssvX/AmyD3vPPEZcK3LnwPO/ObE3d03rHAxdk/ph3cyGl3IIM1sm8qou3Ag== X-Received: by 2002:a5d:55c4:0:b0:33d:5350:774a with SMTP id i4-20020a5d55c4000000b0033d5350774amr6864534wrw.11.1709579862201; Mon, 04 Mar 2024 11:17:42 -0800 (PST) Received: from ?IPV6:2a02:1811:cc83:ee50:280e:1e36:3a00:824? (ptr-dtfv08akcem5xburtic.18120a2.ip6.access.telenet.be. [2a02:1811:cc83:ee50:280e:1e36:3a00:824]) by smtp.gmail.com with ESMTPSA id w13-20020a05600c474d00b00412c1d51a0dsm14030914wmo.45.2024.03.04.11.17.41 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Mar 2024 11:17:41 -0800 (PST) Message-ID: Date: Mon, 4 Mar 2024 20:17:41 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [Discussion] grapheme cluster for str_split function To: internals@lists.php.net References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit From: dossche.niels@gmail.com (Niels Dossche) Hi Yuya This sounds useful. I do have a question about the function signature: function grapheme_str_split(string $string, int $length = 1): array {} This always returns an array. However, looking at your PR it seems you return NULL on failure, but the return type in the signature isn't nullable. Also, from a quick look, it seems other functions return false instead of null on failure. So perhaps the return type should be array|false. What do you think? :) Kind regards Niels On 03/03/2024 00:21, youkidearitai wrote: > Hi, Internals > > I noticed PHP does not have grapheme cluster for str_split function., > Until now, you had to use the PCRE function's \X. > > Therefore, I try create `grapheme_str_split` function. > https://github.com/php/php-src/pull/13580 > It is possible to convert array per emoji and variation selectors using ICU. > > If it's fine, I'll create an RFC. > > Regards > Yuya >