首页  >  文章  >  php教程  >  PHP大数据处理要注意的

PHP大数据处理要注意的

WBOY
WBOY原创
2016-06-06 19:49:121858浏览

1. 传递值使用引用传递 $a = get_large_array(); pass_to_function($a); 这样是传递变量的引用而不是拷贝 2.将大数据存在类的变量中 class A { function first() { $this-a = get_large_array(); $this-pass_to_function(); } function pass_to_function() {

1. 传递值使用引用传递

$a = get_large_array(); 
pass_to_function(&$a); 

这样是传递变量的引用而不是拷贝

2.将大数据存在类的变量中

class A 

function first() 

$this->a = get_large_array(); 
$this->pass_to_function(); 

function pass_to_function() 

//process $this->a 

3.变量使用完毕后尽快的unset变量,释放内存,减小脚本负担负担。

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn