How to check the function parameter?

Hello!

I have a function:

function include() {
 echo ...
}


...which can take one of two options (header or footer).

How to check if the output of the function, what parameter is passed?

if (~include(header)~) {
 the passed parameter 'header'
}


Thank you!
March 19th 20 at 08:34
2 answers
March 19th 20 at 08:36
Solution
And check - through option.

function myinclude($position) {
 if ($position == 'header') {
}
}
myinclude('header');
myinclude('sidebar');
myinclude('fooer');
March 19th 20 at 08:38
You can add a prefix h or f to the value of the parameter, and then check to discard it and use the remaining contents of this argument.

Find more questions by tags PHP