Answer the question
In order to leave comments, you need to log in
Why are parameters not being passed to the php method?
Good evening, explain to a newbie, there are two files and the situation is as follows:
<?php
class Myclass
{
function mymethod($par1,$par2)
{
include 'add/'.$par1;
}
}
class MyClass2
{
function action_index() {
$this->var1 = new Myclass();
$par1 = 'ex3.php';
$par2 = 123;
$this->var1->mymethod($par1,$par2);
}
}
$child = new MyClass2();
$child->action_index();
?>
<?php
echo $par2;
?>
Answer the question
In order to leave comments, you need to log in
I did not understand the question. Your code works, outputs 123.
If done
<?php
class Myclass
{
function mymethod($par3,$par4)
{
include 'add/'.$par3;
}
}
class MyClass2
{
function action_index() {
$this->var1 = new Myclass();
$par1 = 'ex3.php';
$par2 = 123;
$this->var1->mymethod($par1,$par2);
}
}
$child = new MyClass2();
$child->action_index();
<?php
echo $par4;
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question