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

PHP大数据处理要注意的

WBOY
Release: 2016-06-06 19:49:12
Original
1891 people have browsed it

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

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template