Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128495 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 lists.php.net (Postfix) with ESMTPS id 708AF1A00BC for ; Sun, 17 Aug 2025 17:15:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1755450833; bh=Cu2jMlDtn6nhfWc45W2YPS1zQ5x99b2QvIlS4vlBop8=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=khLzVjxzYjs4dSDpDPMpNV4I+DJrXJID1GNNMvZiSmxruvkAX6Eg+I5xAl+EPfID0 NGVaC9b9043DpwqxtPaAVew3FBXxtUzWmOCJtaHR8VSgZLMhcQCUchEAXtbk7uZoPL dqZmc2hzOKoq7DSPgeQAXai5QfNHHe6VyUmrzcw72uGn4TR3/xwfq/n9Qo9Qg0Ta6N TJi/I1v+YKX+wH2qiZsYAQJL17dEM0/tpS4r+KkoODhmM8rBgm4vKwRejjLR9HGMSu TJZfElAvqD0FV8ymN3d0Q7fhJ/ga3Wktq7iVDCrC5gQx4s4a5eR+FE7rqYZZHA2bT1 e8h3UivzNOkQw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 619D418006C for ; Sun, 17 Aug 2025 17:13:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) 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.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (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 ; Sun, 17 Aug 2025 17:13:52 +0000 (UTC) Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-afca41c7d7fso748893066b.1 for ; Sun, 17 Aug 2025 10:15:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755450927; x=1756055727; darn=lists.php.net; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=RqDcK+C7E4+4hk9StNxzIykobz99Kzma5Hkb9CGxtKE=; b=XDLl2JJYxIBMnzAcGVLkGHp+6liobJ6LZkmARpobnzHInHx19d5UYyvaPXHFl/b9fo 38ZmNCs3nmopZKTOHnxTCWhnRoyEzp9HuDqAdriYps8fF0sZ4IDTl6oeSfvlBhF5XhgE iAinYBLXW4t8uMeORg1XwV3hZlv1TF1rgYJ0BqxmIa3twdL0jxfquk47zIn2vgt2D+/7 IGEOL0kp6l6W8rU/aoxU3lpm61XbmXJfQ7bUw1hEdJdJ5bI9Ik5THKn0CfUS3XTHV8Nx 5vBkqMPz17LJihSvPZQVTZ/QAH126AVvcVD7gGeFyUnJ+xqIhMIAh5SHCBTVtAJeweOL lDDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755450927; x=1756055727; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RqDcK+C7E4+4hk9StNxzIykobz99Kzma5Hkb9CGxtKE=; b=IyPXoQ23t4KSKOocHNo7CKjckt7tYGWFHSZHaD4BEJTtSK7XpA/8yi7AkPaX4gJKnA F51Qo5u8VfEMc+Tt3ZHG04U6B6NIU3zPdMPhkRQ8sDz+LxOFyvZ3qYG9sK15i4RkJk94 Rr3k7wihlvjcvwXbO/zB3PLDhVee6n8GfotUEW2ZyucjpyCKiRRxkpukmD3fJVCsw5TP KQ9YbgMxZS7SmQ0gblZFndCUpD8hrq+z3LT3HVXyXUX14qS23uk1NU7GIuWitOu2Pjgr aHmdL58TQQhcyHXnoB9QmS7z1uO/yIXGiw1bsxoPBWVZwhfltoPRbFbp4C8rce/oIDbh TeBw== X-Forwarded-Encrypted: i=1; AJvYcCX0mKoqk+hzXuZyDECPeeS6K4DjjU1J3AeyVnhwpPo1ASoOuUm9/Cy2Sn6jO9gUlk7ptL19Oaf8YXI=@lists.php.net X-Gm-Message-State: AOJu0YyCTHFHWjM/B6jez4eNueZEnZd+Vx/W0NvQDgujtOIVND85Bos4 FzdmG9shoHFrohKjUwmeVeSL68+wuJwoUCmM+IH5OK3wkoXrUYRESrzX X-Gm-Gg: ASbGncuqtCKaUP++0fcRcn4RzLikDGeXT51v4y3CtAyn5vBe43bNaAPVoRbXbAbGKg3 XPbsEijVFXTnJw+D+cRlhM1EfDSMO/qK0fyMvUlPrKCKPsiTswXJy6lInWDrpFexOnNpOzrAHp9 dSQyoWVMbzj4G7idKxJKzGmxv5zGvSHdsl5qkPwpQ8obxYJ3jUWTX2bYNVbgnthuGT3FJg34xnq A6FmXflx53qFx8HoHVSEov42/j4lgcFyGc7YEXnCYmTCQsSrkM9UTwkPV2rafOIVBh4M66q3TJI GllVrZjnau8AGvwl77s6+2vA4f1jhjRvqKBRCfxR9Ta4ReBoZ+kvjTgd038QKUukppAWdA3wGUp qX4kEU/cct/sABgLM0iJJtNs+/Xun9k/45FazYqUHqyGvQQ== X-Google-Smtp-Source: AGHT+IG3+A9FbwaYUzdcdsDmTVgmAj2CaQMdu9//fd0No29L1VE6uR1vmWExmMUtES1OLzaBKJw4rA== X-Received: by 2002:a17:907:7f88:b0:af9:70f0:62e3 with SMTP id a640c23a62f3a-afcbd80bcb6mr1478279666b.15.1755450926343; Sun, 17 Aug 2025 10:15:26 -0700 (PDT) Received: from smtpclient.apple ([178.197.195.129]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-afcdd016bbcsm614972966b.95.2025.08.17.10.15.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Aug 2025 10:15:25 -0700 (PDT) Message-ID: <8255DACE-3D37-4AFD-883D-93E22B6A54B3@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_3567FD45-E0B5-46F8-B8B5-97D6C0AF8484" Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: [PHP-DEV] Split as an alias to explode Date: Sun, 17 Aug 2025 19:15:12 +0200 In-Reply-To: Cc: Paul Dragoonis , mickmackusa , PHP internals To: "Christoph M. Becker" References: <275514FF-2AF0-48D6-B57B-23B18ECCEED8@gmail.com> X-Mailer: Apple Mail (2.3826.700.81) From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_3567FD45-E0B5-46F8-B8B5-97D6C0AF8484 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 16 ao=C3=BBt 2025 =C3=A0 11:16, Christoph M. Becker = a =C3=A9crit : >=20 > On 15.08.2025 at 23:47, Paul Dragoonis wrote: >=20 >> On Fri, Aug 15, 2025, 10:30=E2=80=AFPM mickmackusa = wrote: >>=20 >>> I don't see any benefit to re-adding split() to the language. Why = create >>> more keywords for the sake of a function name with fewer characters? = Code >>> golfing isn't a goal of the language. >>=20 >> Ancient history aside and forward looking; JavaScript took a huge = boom in >> recent years and overtook PHP in areas of new adoption and code DX >>=20 >> Making it a smoother transition for JS devs to hop back on the modern = PHP >> train is in all our shared interest in terms of user base, and = split() >> would help this. >>=20 >> So why not? >=20 > Because it would still be rather confusing to JavaScript developers = who > are used to >=20 > str.split(separator) >=20 > and now would have to deal with >=20 > split(separator, str) >=20 > In my opinion, the difficulty is not the name the name of the = function, > but rather that it is a function and not a method. Having a different > function name, can even be slightly beneficial to stress that = difference. >=20 > Christoph Apart from the order of arguments, there is another confusing difference = between the PHP function and the JavaScript one. Both accept an = additional parameter named `limit`, with subtly but fundamentally = different semantics, and you have to read very carefully the = documentation (or test the function) to understand it. (And to be clear, = I am *not* speaking of the fact that PHP accept a =E2=80=9Cnegative=E2=80=9D= limit: that one is not subtle enough.) The difference of naming is probably the least problematic difference, = and attempting to reduce that specific difference without regard to the = other ones, won=E2=80=99t reduce confusion. =E2=80=94Claude --Apple-Mail=_3567FD45-E0B5-46F8-B8B5-97D6C0AF8484 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

Le 16 ao=C3=BBt 2025 =C3=A0 11:16, Christoph M. = Becker <cmbecker69@gmx.de> a =C3=A9crit :

On 15.08.2025 at 23:47, Paul Dragoonis = wrote:

On Fri, Aug 15, 2025, 10:30=E2=80=AFPM = mickmackusa <mickmackusa@gmail.com> wrote:

I don't see any benefit to re-adding split() to the = language. Why create
more keywords for the sake of a function name = with fewer characters? Code
golfing isn't a goal of the = language.

Ancient history aside and forward looking; = JavaScript took a huge boom in
recent years and overtook PHP in areas = of new adoption and code DX

Making it a smoother transition for = JS devs to hop back on the modern PHP
train is in all our shared = interest in terms of user base, and split()
would help = this.

So why not?

Because = it would still be rather confusing to JavaScript developers = who
are used to

 str.split(separator)

and now would have to deal with

 split(separator, str)

In my opinion, the difficulty is not the = name the name of the function,
but = rather that it is a function and not a method.  Having a = different
function name, can even = be slightly beneficial to stress that difference.

Christoph

Apart = from the order of arguments, there is another confusing difference = between the PHP function and the JavaScript one. Both accept an = additional parameter named `limit`, with subtly but fundamentally = different semantics, and you have to read very carefully the = documentation (or test the function) to understand it. (And to be clear, = I am *not* speaking of the fact that PHP accept a =E2=80=9Cnegative=E2=80=9D= limit: that one is not subtle enough.)

The = difference of naming is probably the least problematic difference, and = attempting to reduce that specific difference without regard to the = other ones, won=E2=80=99t reduce = confusion.

=E2=80=94Claude


= --Apple-Mail=_3567FD45-E0B5-46F8-B8B5-97D6C0AF8484--