I want to print my name inside loop for 1 crore time but it throwing fatal error that Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) in C:\xampp\htdocs\test\index.php on line 10 Even after i set max_execution_time=0
<?php
ini_set('max_execution_time', 0);
$startTime = time();
$pos = 0;
for ($i = 0; $i <10000; $i++)
{
for ($j = 0; $j <1000; $j++)
{
$person[$pos] = new Person('dipti');
echo $person[$pos]->getName() . " | ";;
$pos++;
}
}
echo "<br>";
$endTime = time();
echo $endTime - $startTime . " seconds taken";
class Person
{
private $name;
/**
* Person constructor.
* @param $name
*/
public function __construct($name)
{
$this->name = $name;
}
/**
* @return mixed
*/
public function getName()
{
return $this->name;
}
}
?>