3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace ns1; class c1{} namespace ns1\c1; class c11{} namespace main; use ns1\c1; $c1 = new c1(); $c11 = new c1\c11(); function takes_c1(c1 $foo) { var_dump(get_class($foo)); } function takes_c11(c1\c11 $foo) { var_dump(get_class($foo)); } var_dump(get_class($c1)); // object(ns1\c1)#1 (0) { } var_dump(get_class($c11)); // object(ns1\c1\c11)#2 (0) { } takes_c1($c1); takes_c11($c11);
based on 0kV1o
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.3.1
string(6) "ns1\c1" string(10) "ns1\c1\c11" string(6) "ns1\c1" string(10) "ns1\c1\c11"