Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123858 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 F371D1A009C for ; Wed, 26 Jun 2024 06:10:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719382311; bh=Fzhqd8tXGK6cK3CbSXS+ycK0dmZcTqxwKrS5UQ8EfxE=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=nwD0JYep0EXVryJ2Fb/QV9W+rdgvcRVBBcbB2xUficaGWRo1vy4VKkklefoS5RtxB wQ5mnUXe8oy4GpXZup4Og42x33FAYOjfeAIDqOTimbok/J50bNAs67NYXNWwrf+h0h JrmCGn6Zd8qxRp+hQhkae2NUM1KCA6/oJMJfag0f8CxHWem1RBEbz+pyvqFZmU6VZb /+hES/WcbKsxG2XsdRal+jlPRVyE7OXmhA5mJNMAfMz2JY1S1l7i11rZ/+b2E67LIk e0dc+WLEcdSteT4lB+wBLE8wylG+64OflNWgE4t2+KvZratEtHhpBB/5FsGXG8tjwh FMbHP4ODh4s1w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3D7B6180056 for ; Wed, 26 Jun 2024 06:11:50 +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.8 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DMARC_MISSING,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) (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 ; Wed, 26 Jun 2024 06:11:49 +0000 (UTC) Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-e02da9b2db7so6027069276.3 for ; Tue, 25 Jun 2024 23:10:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20230601.gappssmtp.com; s=20230601; t=1719382232; x=1719987032; darn=lists.php.net; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Fzhqd8tXGK6cK3CbSXS+ycK0dmZcTqxwKrS5UQ8EfxE=; b=mltq5fvJZDommJ5i18Rn1ASNMYIH7wgynXQmSD/UWUUdhL35AGtthY+LQXfYiuOZTa cTqVL3uuNUfKpAmd83D2m8uYyltSeR5HBSYEHSY47yaUO/h46hyIBa4JmA5uz1rxVC0M 778DxSDLSy0LhJNTPyxRMVorhjEizhzzgJWKZJjdFtfG1kwWXkwLhhx7JAZfaZcLVPaA S4G5gO252swfj4YSV2pCEiomfNrjSzn8ed/M9fJwaQM7afcnmD1VSG+RYenHjo6DFpeB UZWIae1Js4MHVmWIXFCX/w1aydiYe3pW0yo8uKeVxexxi2nKhA5GPd4wvIR8iZrUjDHv M+Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719382232; x=1719987032; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Fzhqd8tXGK6cK3CbSXS+ycK0dmZcTqxwKrS5UQ8EfxE=; b=RGncAI3w4IsfzpLp+mPC1Hrdwbe8Ji97V1CVY7YNNT1xtZD340g0AWyZmiMLdYLA+4 GwEUL2CXLIX66j5WLPMuqW1umoYHqmat7Ce6wGFTYHxOw53vMLy7/qUSuBWTC9hbVmlJ BgPZ2nFOaIEXwT8KG1xmBsAOgOVXG56GH7kxbuEHsMo9RlV9emfPTOAITHCMo2v3Suos e9I9E7DM3SAvHksP7HKSN3AXtf4ME1zIgLxAwU9gJBHXUnpb0oB4e8YAO/5ieRqflvFa yAsfYyh3WKI3jl1eyADzPAIrAkPqbqHy5ABDZ8iyl4C3C6ALib6hDF0ZAGDUA/Id2oAB 06kA== X-Forwarded-Encrypted: i=1; AJvYcCX24Lo+XIgXuqLdbjPYcDjFrLL8hmfm54BjtxEC5pIkMXdk/ExVW7mL+W0wouPdCDZ/GRJA7m10ri6kxNMDryphLtHgrdzrhw== X-Gm-Message-State: AOJu0YwY+Q6NyjfL+ZQ9LszfFIaBpubu4wnSm1mql4SN9G06/7t+ae4u DJ3pA+JjfXVlxcEJaRRQ0WgpNZw9jMVtFaMcY+YIvev9rLpi26aL+fh7fyCr8RM= X-Google-Smtp-Source: AGHT+IEnLkfEQEv8NdDBmT/hklL76D2eLkDPZQYwRrfCRj9TXs1eIzdeVpMIN08PGKk+/lI7cDOSAg== X-Received: by 2002:a25:d050:0:b0:e03:363f:9c6 with SMTP id 3f1490d57ef6-e03363f0c15mr606979276.34.1719382231786; Tue, 25 Jun 2024 23:10:31 -0700 (PDT) Received: from smtpclient.apple (c-98-252-216-111.hsd1.ga.comcast.net. [98.252.216.111]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e02e65dbb35sm4328559276.59.2024.06.25.23.10.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jun 2024 23:10:31 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.8\)) Subject: Re: [PHP-DEV] [RFC] Deprecations for PHP 8.4 In-Reply-To: <0DE5ACCD-C321-4872-ADDA-B7F716FC41B0@woofle.net> Date: Wed, 26 Jun 2024 02:10:30 -0400 Cc: "Gina P. Banyard" , PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <0DE5ACCD-C321-4872-ADDA-B7F716FC41B0@woofle.net> To: Dusk X-Mailer: Apple Mail (2.3696.120.41.1.8) From: mike@newclarity.net (Mike Schinkel) > On Jun 26, 2024, at 1:39 AM, Dusk wrote: >=20 > On Jun 25, 2024, at 22:18, Mike Schinkel wrote: >> This leads me to think `strtok()` should not be deprecated given how = inefficient string handling in PHP can otherwise be, at least not = without a much more efficient object for string parsing. >=20 > What would be really useful as a replacement for strtok() - among = other things - would be a function analogous to MySQL's = SUBSTRING_INDEX(): >=20 > = https://dev.mysql.com/doc/refman/8.4/en/string-functions.html#function_sub= string-index >=20 > Where SUBSTRING_INDEX($a, $b, $c) is functionally equivalent to = explode($a, $b)[$c], but with the added ability to use negative indices = to count from the end of the input. Yes. There are numerous quality-of-life functions like that which would = improve PHP DX, performance, and likely security if incorporated into = the standard library.=20 Unfortunately there is a generally antipathy on this list towards adding = functions that "can be written in userland" even though relegating them = to userland means many people writing, writing about and publishing many = different named functions doing similar and often incompatible things, = and doing them less efficiently than if the one-time bullet was bitten = and they were written in C, added to the docs, and included in core PHP.=20= #fwiw -Mike P.S. And no, `SUBSTRING_INDEX($a, $b, $c)` would not add a significant = maintenance burden. Simple functions are an order of magnitude easier to = maintain than, for example, adding new syntax for new language features, = or adding a library feature needs to be upgraded in response to an = evolution orthogonal to PHP, such as supporting a file format, a = protocol or database connector.=