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
little bottleOriginal
2019-04-23 10:03:472151browse

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
?>

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!

Statement:
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