{ echo __METHOD__ . "()\n"; var_dump($ar); } static function f4(array $ar = array(25)) { echo __METHOD__ . "()\n"; var_dump($ar); } } Test::f1(array(42)); Test::f2(NULL); Test::f2(); Test::f3(); Test::f4(); Test::f1(1); ?> --EXPECTF-- Test::f1() array(1) { [0]=> int(42) } Test::f2() NULL Test::f2() NULL Test::f3() array(0) { } Test::f4()
<?php /** * Part of Windwalker project. * * @copyright Copyright (C) 2014 {ORGANIZATION}. All rights reserved. * @license GNU Lesser General Public License version 2.1 or later. */ include_once __DIR__ . '/../../../vendor/autoload.php'; $benchmark = new \Windwalker\Profiler\Benchmark(); class Test { public function f1() { md5(uniqid()); } public static function f2() { sha1(uniqid()); } } $f1 = function () { $t = new Test(); $t->f1(); }; $f2 = function () { Test::f2(); }; echo $benchmark->setTimeFormat(\Windwalker\Profiler\Benchmark::MICRO_SECOND)->addTask('test1', $f1)->addTask('test2', $f2)->execute(10000)->render(6, 'asc');