Friday, August 21, 2009

MY Back UP

PHP BACK UP :

This is only for my reference others dont use it
http://www.efreelearn.com/BCP/test/BCP_CALL_COMMON.html


PHP Oject CODE


// first test simple associative arrays
$memory1 = xdebug_memory_usage( );

$data = array();

for($i=0;$i<1000;$i++) {

$data[] = array(
'property1' => md5(microtime()),
'property2' => md5(microtime()),
'property3' => md5(microtime()),
);

}

$array = xdebug_memory_usage()-$memory1 . "\n";

// Now do the same thing, but with a class..

class Test {

public $property1;
public $property2;
public $property3;

}

$data = array();

$memory1 = xdebug_memory_usage( );

for($i=0;$i<1000;$i++) {

$test = new Test();
$test->property1 = md5(microtime());
$test->property2 = md5(microtime());
$test->property3 = md5(microtime());
$data[] = $test;


}

$object = xdebug_memory_usage()-$memory1;

echo 'Arrays: ' . $array . "\n";
echo 'Objects: ' . $object;

?>

No comments: