PHP get_class_vars 和 (array)

<?php

class Girl
{
    public $id = 1;
    public $name = 'zhy';
}

$start = microtime(TRUE);
var_dump(get_class_vars(get_class(new Girl())));
$end = microtime(TRUE);
echo "\n" . ($end - $start) . "\n";

$start = microtime(TRUE);
var_dump((array)(new Girl()));
$end = microtime(TRUE);
echo "\n" . ($end - $start) . "\n";

一次测试,只看一次的测试:

 

posted @ 2017-07-11 13:47  GoodByeZ  阅读(397)  评论(0编辑  收藏  举报