Skip to content

Instantly share code, notes, and snippets.

@saeidw
Last active December 11, 2015 18:49
Show Gist options
  • Save saeidw/4644671 to your computer and use it in GitHub Desktop.
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
<?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