how to run the function on load of my php without using jscript?
628
I want to display the output inside the class I declare by calling the function I declared inside it. How do I do that?
<?php
class Testscript3
{
private $var_a;
private $var_b;
private $var_c;
private $var_d;
function test1()
{
$this->var_a= array(256,376,129);
$this->var_c= 7;
$this->var_e="GLOBALVARIABLE";
}
function test2($param1)
{
$nwvar1=($param1 * 11)+2;
$nwvar2=substr($nwvar1,0,1);
return $nwvar2;
}
function performer()
{
$this->test1();
$this->var_b = $this->var_a;
$arr_1= $this->var_a;
$arr_2= $this->var_b;
$rowComp=0;
echo"<html><body>";
echo"<table border=1>";
for($aa=0; $aa< count($arr_1);$aa++)
{
for($aa=0; $bb< count($arr_1);$bb++)
{
$rowComp=($arr_1[$aa] +$arr_2[$bb]) + $this->test2((7+ $bb)* $arr_2[$bb]);
echo"<tr>";
echo"<td>$arr_1[$aa]";
echo"<td>$arr_1[$bb]";
echo"<td>$rowComp";
echo"<td>";
if ($bb==0)
{
echo "A";
}
else
{
echo "$this->strtolower(substr($var_e, $aa, $bb))";
}
echo"</td>";
echo"</tr>";
}
}
echo"</table>";
echo"</body>";
echo"</html>";
}
performer();
}
?>
I want to see the value of the output I made. How do I call the function inside the class?
Answer
Solution:
To call a function of a class: