I have Created following class in flie index.class.php
:-
<?php
class index{
public function loadTitle() {
$title = "Welcome to My Website";
return $title;
}
}
?>
And now, I am using it like below in my index.php
file
<?php
require_once("index.class.php");
$obj = new index();
echo $obj->loadTitle();
?>
My question because the Page will become heavy with lots of article and images, and I will expect 1500-2500 user every day in it.
Do I need to also unset memory, I know PHP has its own garbage collector, but following URL scares me out :- www.google.com/search?q=php+memory+leak+with+new
and I saw a few questions in StackOverflow saying it does consumes memory, and certain people have suggested to use the unset
function, but I am not sure how to do it..
This is my attempt:
Do I need to only call
<?php
unset($obj); // At the end of the page, or where i will no more be using this object.
?>
Or I have to set NULL value too.
<?php
$obj = NULL;
unset($obj);
?>
Is the above code fine for releasing memory, or do I need to do something else too? Please suggest and teach me!