{ function go() { include_once "myinclude.php"; } } class test2 { function go() { echo 'k'; } } $time_start = getmicrotime(); for ($i = 0; $i < 10000; $i++) { $bla = new test1(); $bla->go(); } echo '<br><br>'; $time_end = getmicrotime(); $time = $time_end - $time_start; echo 'Page generated in ', number_format($time, 3), ' seconds<br><br><br><br>'; $time_start = getmicrotime(); for ($i = 0; $i < 10000; $i++) { $bla = new test2(); $bla->go(); } echo '<br><br>'; $time_end = getmicrotime(); $time = $time_end - $time_start; echo 'Page generated in ', number_format($time, 3), ' seconds<br>';
<?php include_once "test1/test1.php"; include_once "test2/test2.php"; $test2 = new test2(); $test2->test();
<?php /** * Project:zhiqiang.cao * User: zhiqiang.cao * Date: 2015/4/2/20:32 * Filename: require.php */ require_once './test.php'; class test2 { public function test() { $test = new test(); $test->demo(); } } $demo = new test2(); $demo->test();
$t2->method3($num); echo "=============\r\n"; $t2->method4("%s,%s,%s", 1, 2, 3); echo "=============\r\n"; $t2 = NULL; echo "=============\r\n"; $t3->method1(334); echo "=============\r\n"; $t3->method2(333); echo "=============\r\n"; $t3->method3(336); echo "=============\r\n"; $t3 = NULL; echo "=============\r\n"; base_test::static_method(); echo "=============\r\n"; test::static_method(); echo "=============\r\n"; test2::static_method(); echo "=============\r\n"; $ref = new ReflectionClass('basics'); Reflection::export($ref); echo "=============\r\n"; $ref = new ReflectionClass('base_test'); Reflection::export($ref); echo "=============\r\n"; $ref = new ReflectionClass('test'); Reflection::export($ref); echo "=============\r\n"; $ref = new ReflectionClass('test2'); Reflection::export($ref);
<?php class test2 { function ts() { $id = isset($_GET['id']) ? $_GET['id'] : "ehe"; echo $id; } } $s = new test2(); $s->ts();