Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121980 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 11195 invoked from network); 10 Dec 2023 17:25:38 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 Dec 2023 17:25:38 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C8C3E180038 for ; Sun, 10 Dec 2023 09:25:52 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-vs1-f45.google.com (mail-vs1-f45.google.com [209.85.217.45]) (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, 10 Dec 2023 09:25:49 -0800 (PST) Received: by mail-vs1-f45.google.com with SMTP id ada2fe7eead31-462e70f1c20so1004774137.0 for ; Sun, 10 Dec 2023 09:25:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702229133; x=1702833933; darn=lists.php.net; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=STPCadhzSYa+1BfZq8wqe3D3tD56cZ6KTVFNHyL7xwk=; b=lGHOt6Z94cdzR+iVS0ni4fzR9n3u2/XAfTfhos19OM/NHCQ0c5EyeNJbCHH+jRcMVL IupfnItaFri/eLrs8o24+DDAYGVNHCYaORWG9kQuGzcmqqflArdaXaanRUyTxrMQz2Bq DK+Gf/Ot45qqecGgoT1ZeTlF2ogermUbpdjyXOFOGICiQEeGqxN6hye4oJszrXIgGd/m fF/bYwwbxvZaevuTVA6A5n3QU4/TWq+DEgh0M72McLB7PFG94k4Tjp0UeHytKkZxrC2G nV70OYe9NzVNE/VQRX+ZGtLgbhheTvQnsZE9bWUsxLF2dZF4A0c5Xo2mFd/Ynl3adLFl 1hLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702229133; x=1702833933; h=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=STPCadhzSYa+1BfZq8wqe3D3tD56cZ6KTVFNHyL7xwk=; b=QjqTpRayzoLlNAX8JZKb83nEtwIN+4OKUYwE1tUpK/kCJC8/hNSPVtrrrM9YLBskeM OEPa/SGLYZUSI1swb5D1uz3Qj3bdT4HBGUovYzd+B6rBl7lDgBvV2jEXv7uu8dcB4aUL Im4x3okK1rz/BQIhC0jS4YsMQgM7isWcBPplZGffX5SuAZkCwbc7jjdjHf2+EiLgaHxg 6lPrGJ+M90nxMk2jS+x9o1thGjlndxPZJPoU5OhrLCLQ/0Q+ZIaOtcwULlt48ijv0GiU EaYVrKqYDn57rH+OLV+eWANTummORWQwBeumPCKYdD5inmAc/FKx9TGsZiHrGMtuFwHz MLwA== X-Gm-Message-State: AOJu0YytCGfJNqcPGXPdM+tSfcj0tfdkLjdNm5642iqD59DTySDxe5iU aE80KeYMf9XZpQTk8RwAbJ6ViJvLZ2iYiiuT7N4hjqSnz4msSQ== X-Google-Smtp-Source: AGHT+IFG405BNot6wm2zzg8rvjNnFRENbHpTKx0eDTrcKg9eq08EpPKgwE+vx01dHPleCLxu1cDewf1aXGc/aepvi+E= X-Received: by 2002:a05:6122:4c08:b0:4b2:8446:a9d4 with SMTP id ff8-20020a0561224c0800b004b28446a9d4mr1792602vkb.12.1702229132963; Sun, 10 Dec 2023 09:25:32 -0800 (PST) MIME-Version: 1.0 References: <8f4e3274-6489-4378-82db-fb4829770196@gmail.com> <8038a817-c65e-4493-8110-4709943c54a1@gmail.com> In-Reply-To: <8038a817-c65e-4493-8110-4709943c54a1@gmail.com> Date: Sun, 10 Dec 2023 14:24:56 -0300 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000cbf3ff060c2b1a66" Subject: Re: [PHP-DEV] Filesystem path APIs From: ericklima.comp@gmail.com (Erick de Azevedo Lima) --000000000000cbf3ff060c2b1a66 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I'm in favor for this. I think that, since you already have a built-in file API, adding useful functions is always good. I use *\str_starts_with* and *\str_ends_with* a lot in my code. In Laravel, which is the most used Framework these days, you have the \Illuminate\Supports\Str::startsWith and \Illuminate\Supports\Str::endsWith, but it did stop the implementation of those functions in the core and I'm glad for it. Best regards, Erick Em s=C3=A1b., 9 de dez. de 2023 =C3=A0s 13:21, Niels Dossche escreveu: > On 12/9/23 10:40, David CARLIER wrote: > > On Fri, 8 Dec 2023 at 16:10, Niels Dossche > wrote: > > > >> Hi David > >> > >> On 08/12/2023 10:08, David CARLIER wrote: > >>> I think these would be great additions to PHP as working with pat= hs > >> and files is a core part of any programming language. > >>> > >>> > >>> Seems like it, is there an argument to be made to, let's say, in the > >> performance side ? > >> > >> A native implementation is going to be faster than an implementation i= n > >> userspace. > >> However, I don't think that matters because the performance is likely > >> dominated by the I/O you do after constructing a path. > >> You'd need to construct a large number of paths before you notice > anything > >> I guess. > >> > >> Cheers > >> Niels > >> > > > > Very true, so what would be the argument beside having those as > "builtins" > > as opposed to external components ? > > > > Mainly for convenience reasons and a correct implementation provided by > PHP. > Many functions in PHP are not strictly necessary because they can be > implemented in userland. > They're only there for convenience reasons. Where to draw the line is > difficult. > To me they complement the realpath(), dirname(), basename() functions. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > --000000000000cbf3ff060c2b1a66--