Home  >  Article  >  php教程  >  PHP大数据处理要注意的

PHP大数据处理要注意的

WBOY
WBOYOriginal
2016-06-06 19:49:121854browse

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变量,释放内存,减小脚本负担负担。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn