Home > Backend Development > PHP Tutorial > [PHP Learning] Use case analysis of class name::class

[PHP Learning] Use case analysis of class name::class

little bottle
Release: 2023-04-06 09:04:01
Original
2153 people have browsed it

This article mainly uses an example to describe the meaning and usage of "class name::class". It has certain learning value and interested friends can learn about it.

[PHP Learning] Use case analysis of class name::class

Since PHP 5.5, the keyword class can also be used for class name resolution.
Use ClassName::class to get a string containing the fully qualified name of the class ClassName. This is especially useful for classes that use namespaces.

<?php namespace ddd{
    class Demo{
echo Demo::class; //输出ddd\Demo
?>
Copy after login

Related tutorials: PHP video tutorial

The above is the detailed content of [PHP Learning] Use case analysis of class name::class. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template