marți, 19 octombrie 2010

Free memory usage (RAM)

When you're coding please consider the use of ressources, best way to optimize a code is to make sure that there aren't any memory leaks.

Using the command unset($variable,$var2) you can free the memory that is allocated by variable/constats.

I will give a simple example, how to use that function

<?php 
$a="something";$b="2";$c[0]="x"; $c[1]="yes";
//free memory usage
unset($a,$b,$c);
//after you used unset, $a,$b,$c will be NUL
?>

Simple and eficient!

Niciun comentariu:

Trimiteți un comentariu