3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace A; class Test { public function __construct(){} public function testEchoName() { echo "self::class: ".self::class; echo "\n"; echo "get_class: ".get_class($this); echo "\n"; echo '__CLASS__: '.__CLASS__; echo "\n"; echo 'basename(__CLASS__): '.basename(__CLASS__); } } $test = new Test(); $test->testEchoName();
based on GKOno
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.23, 7.4.0 - 7.4.13, 8.0.0
self::class: A\Test get_class: A\Test __CLASS__: A\Test basename(__CLASS__): A\Test