Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120413 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 10981 invoked from network); 28 May 2023 07:34:38 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 May 2023 07:34:38 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 746AA180505 for ; Sun, 28 May 2023 00:34:37 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, 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=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 28 May 2023 00:34:36 -0700 (PDT) Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-bacf685150cso4511737276.3 for ; Sun, 28 May 2023 00:34:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685259276; x=1687851276; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ogh96WK43mo7/UBy90c9wQp62+gV1Bh6dlfGfkCY9I0=; b=LNLDNygFLanrKG5lTslPfO9g6+VdDJgyZagWxtYDwG7ykNQVLevvNboogwENuCYcZb UMwgUbwJcLgB5OZdetqBpUISU0I1iYiTuv6pfKuixvE/0dOgFvWaKe7Z4Wnev5wRS0oa C63Md2YPSVrCuah7Ua70tDJx68xKeON9red75dT6kPw9cfNwR92NoowfUQQ8lc40PQgT Lz3hEI0RuQZ1qkbDkYFU7K0/iA//aaaZeCQr8v2HrDzjEdCVdKsd2p5MqpnjCIs4c//g Mrh3Ty5ciOMBgeY0RE/hBu+Ca2QNtuDiOEwH+0l1FJ8KarJNXCpo6zZ6/kH6SC+8OoNs TGHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685259276; x=1687851276; 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=ogh96WK43mo7/UBy90c9wQp62+gV1Bh6dlfGfkCY9I0=; b=E8OL6IDBNCyIH10h9zItWTi0U1FvGMUxFKWzZS2M/geT0/HyYg8eISrtz7z25TgIRQ rj5rA3wbEOC0xkwytGlgKIfV91WHfGQ/+uMj0UiJ9+ntI8zAAMeHHqd+XNTnaWssKFWu ro/Zx7OhmE3X8YDdca73i7DhC67MjB6ba9BPDD5HyMvfuZnHZjGyAnW8JF7RYz6XwAFX AREua/9GQnO+qWQKFLz1cpaVU8QUyenVnr8DYsZLP5ZWtM4qselF6f0LP5MDSm+8qjuZ MAC7ZwLzMc/Ig6o7Fs0p+3YEKRU2MllLis4znUboNrz7JWMuuQ+YrUxBqodeSnWnml31 A07Q== X-Gm-Message-State: AC+VfDyO5ahz7XMg6RnuRnGguPUi6U88pgafN9Itk8ecVGIxQstg0SjC sTM1b6eVcmXYYjkK/EYuI/HnL/yoQzLQEf5RVLo= X-Google-Smtp-Source: ACHHUZ56udjKh4b/+1/CLtXRxvYwGqp9Hyf8ksJZdmOAap4TMy52g1aNNM46d7jJJX1cESpZOptXV6tYqmF6Td+ZqN8= X-Received: by 2002:a25:5017:0:b0:ba2:ca56:7206 with SMTP id e23-20020a255017000000b00ba2ca567206mr7727438ybb.17.1685259276160; Sun, 28 May 2023 00:34:36 -0700 (PDT) MIME-Version: 1.0 References: <19548b21-408d-d323-d97a-5799b4b3f368@gmail.com> In-Reply-To: <19548b21-408d-d323-d97a-5799b4b3f368@gmail.com> Date: Sun, 28 May 2023 09:33:57 +0200 Message-ID: To: Niels Dossche Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] mb_ucfirst and mb_lcfirst From: divinity76@gmail.com (Hans Henrik Bergan) I think it would be useful. For some reason, lots of people on stackoverflow has a hard time implementing this function in userland: on https://stackoverflow.com/questions/2517947/ucfirst-function-for-multibyte-character-encodings there are 10 broken implementations of mb_ucfirst, and 1 correct one (disclaimer: I only consider my own implementation correct: https://stackoverflow.com/a/58915632/1067003 and consider every other implementation on the list broken in one way or another. and i was really surprised that nobody else got it right.) On Sat, 27 May 2023 at 23:11, Niels Dossche wrote: > > Hey internals > > I recently saw a comment on Reddit about the lack of a multibyte version of ucfirst and lcfirst. > I was surprised to see this is indeed the case. > I also checked the modes of mb_convert_case: the closest supported one is title case, but there's no mode for only handling the first letter. > > I have two questions (and some sub-questions): > Does anyone know if there is a historical reason for this? A quick search on externals.io didn't provide something useful. > Do you think this is useful? If yes, do you think this should be part of mb_convert_case or should this be a standalone function? > > Kind regards > Niels > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php >