Last active
December 11, 2015 18:49
-
-
Save saeidw/4644671 to your computer and use it in GitHub Desktop.
For reference: $ php -v
PHP 5.4.9 (cli) (built: Nov 21 2012 19:54:46)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Z; | |
class TestClass { | |
public function __construct() {} | |
public function test() { return "test()"; } | |
} | |
namespace Q; | |
use Z\TestClass; | |
// Always fails | |
$k = '\Z\TestClass::test'; | |
echo $k(); | |
// Works, I didn't even know this syntax was possible | |
$k = array('\Z\TestClass', 'test'); | |
echo $k(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment