这个问题与php5中的向下转换有关
这个 php 向下转换的解决方法有多贵?
这个 php 向下转换的解决方法是否太贵了?
我已经回应了 microtimes,它似乎需要 0.001。我想知道这是否可能是大型 foreach 中的问题。
public static function to($obj) {
return unserialize(preg_replace(
'/^O:\d+:\"(\w+)/',
'O:' . strlen('this_class_name') . ':"' . 'this_class_name',
serialize($obj)));
}
http://php.net/manual/en/language.types.type-juggling.php评论中提出的解决方案类似。