I was thinking today at how all the OOP works.
And i was thinking: Wouldn’t be great to check if a method exists using a given text value ?
So, if i have a text function_name_in_text_format, how do i check if the method function_name_in_text_format exists ?
I heard of a solution, something with using $$, but could not find real examples
You can use the is_callable() function.
There are also the function_exists() and method_exists() functions that can be used as the name indicates.
The method for using $$ is known as variable variables.
Included below is an example for using
is_callable():<?php
// How to check a variable to see if it can be called
// as a function.