Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113275 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 64852 invoked from network); 25 Feb 2021 23:29:05 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Feb 2021 23:29:05 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 12D1B1804E1 for ; Thu, 25 Feb 2021 15:18:11 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from sender4-op-o11.zoho.com (sender4-op-o11.zoho.com [136.143.188.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 25 Feb 2021 15:18:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614295088; cv=none; d=zohomail.com; s=zohoarc; b=bDW78GRZnmMeE9jY9f+8CmqGUn2icosiQEpjhquva8DK91CliuSjuK07NH+m4zjCaSzfpC/i9JYHg8RbPPjqoC41kGKtsbb265EvYNgkA8ttI7M90GszYivdOe7ZjNceO+jnRinY/4B1qMfeWVCjCP52/UkWqwOMU57DY0Vhs4M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614295088; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=skshqukkbn6eLlAMAG5qbxZA8CqUA9aRQ8HW4/TshaU=; b=HCWmTnDZG06bHa+ulfF9dyb4DGHe10JpV/cH2PJFAhLniJgfHKNmiZ6pBsuogaae939lN/nounmoNNBAqUhU9TvxjI+Oa93eZsQNfEiO2nsGiyP/6vCR2X7iE9gO6Uua3OmcRkFiQTtufk+38Sa41a2Goar8UVzY/4T5pF2kcIo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=manuelcanga.dev; spf=pass smtp.mailfrom=php@manuelcanga.dev; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1614295088; s=zoho; d=manuelcanga.dev; i=php@manuelcanga.dev; h=Date:From:To:Cc:Message-ID:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=skshqukkbn6eLlAMAG5qbxZA8CqUA9aRQ8HW4/TshaU=; b=Oh05/EfYplM1Tw3MXimb5TDJrI21CM7squEnSRgVBGmc4QcL8u1Gj7QBeEFwoFTv BWmvI6ggu0Diy2fci3aTx89dYXWRlqXAfzFbf9mHlnKzf29jRqgqxT2ZJXw6owoBEDX MWL8TQg3JPe+hvPLTcqq5vEqBboC2auM1OL/U+Cs= Received: from mail.zoho.com by mx.zohomail.com with SMTP id 1614295056262568.3186931486514; Thu, 25 Feb 2021 15:17:36 -0800 (PST) Date: Fri, 26 Feb 2021 00:17:36 +0100 To: "David Gebler" Cc: "Internals" Message-ID: <177db7bbf72.ecf4615f732310.8822018854991483226@manuelcanga.dev> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Importance: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail Subject: Re: [PHP-DEV] [RFC] class_name:namespace From: php@manuelcanga.dev (Manuel Canga) -- Manuel Canga Zend Certified PHP Engineer=20 Websites: https://manuelcanga.dev | https://trasweb.net Linkedin: https://es.linkedin.com/in/manuelcanga ---- En jue, 25 feb 2021 23:12:23 +0100 David Gebler escribi=C3=B3 ---- > You can achieve what you're trying to do already with a combination of > get_class() on a namespaced class and a simple regex (or other method of > processing a string to your liking): >=20 > $foo =3D "My\\Namespace\\Name\\Class"; > var_dump(preg_match('/^(.*)\\\([^\\\]*)$/m',$foo,$matches),$matches); >=20 > array(3) { > [0] =3D> > string(23) "My\Namespace\Name\Class" > [1] =3D> > string(17) "My\Namespace\Name" > [2] =3D> > string(5) "Class" > } >=20 > Regards > David Gebler >=20 Hi, David. ::namespace notation would be more semantic and faster. Other example: In WordPress, classes use class-{{class-name}}.php notation = for file of classes[1]. Example: class-wp-error.php An autoloader for WordPress could be: ```