I want to ask you, in PHP if I created a new class in a function, will the memory freed in the end of the function?
For example: Class
class config
{
var $mapProp = array("x"=>4333, "y"=>3520, "w"=>128, "h"=>128);
var $gameProp = array("maxLevel"=>14, "tilesSize"=>256);
var $mapUrl = 'map_files';
function getMapProp()
{
return $this->mapProp;
}
function getGameProp()
{
return $this->gameProp;
}
function getMapUrl()
{
return $this->mapUrl;
}
}
$config = new config();
and the function
class framework
{
function getUserMap()
{
require("class/config/config.php");
require("class/imageManipulation/image.php");
$mapUrl = $config->getMapUrl();
$x = $_GET['x'];
$y = $_GET['y'];
$level = $_GET['level'];
$main_img = $mapUrl.'/'.$level.'/'.$x.'_'.$y.'.jpg';
//Create a new class
$image = new imageManipulation();
//Set Up variables
$image->setProp($config->getMapProp());
$image->setGameProp($config->getGameProp());
return $image->getImage($main_img, $level, $x, $y);
}
}
$framework = new framework();
require("class/framework/framework.php");
$path = $_GET['path'];
switch ($path) {
case 'usermap':
$framework->getUserMap();
break;
}
in the getUserMap I have used two classes. One of them is the $config class the other is the $image class, after the end of the function will the memory used for this two classes be freed?
All the best, Robert.