I want to use a function with an argument as a dynamic condition, but can’t figure out how to make it work. Is it even possible?
Function e.g. sample_function(‘hello’)
I want to use a function with an argument as a dynamic condition, but can’t figure out how to make it work. Is it even possible?
Function e.g. sample_function(‘hello’)
function my_function() {
// do stuff to create return value - e.g. true or false
return $value
condition, dynamic, condition field - if (whatever - if not true, if < 100 etc.)
{echo:my_function}
Thanks but my function looks like this:
function my_function($hello) {
// do stuff to create return value - e.g. true or false
return $value
}
And I call the function like this: my_function(‘apple’);
I’m pleased for you, but you asked how to make it work as a condition. Screenshot = Heading won’t show if the return is true… but obviously you can have other checks.
Thanks, so I would put in {echo:my_function(‘apple’)}?
I tried that and it didn’t work.
I don’t know… what the hell has apple got to do with anything? What’s your function? You couldn’t give less information if you tried. Maybe actually explain what you want to do in enough detail and we can attempt an answer.
@digismith I appreciate you trying to help but relax bro.
See here to learn about functions with arguments: PHP: Function arguments - Manual
- yes, it was a stressful day yesterday. I know what function arguments are. I don’t know what you are trying to achieve. Until I do, I can’t help.
You’ll need to share more info.
The my_function(‘apple’) example is working, it’s likely a issue inside your actual function or a typo somewhere.
eg… Is it an apple?