Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8198655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:59:42+00:00 2026-06-07T05:59:42+00:00

I was thinking today at how all the OOP works. And i was thinking:

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:59:43+00:00Added an answer on June 7, 2026 at 5:59 am

    You can use the is_callable() function.

    Verify that the contents of a variable can be called as a function.
    This can check that a simple variable contains the name of a valid
    function, or that an array contains a properly encoded object and
    function name.

    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.

    A variable variable takes the value of a variable and treats that as
    the name of a variable.

    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.

    //
    //  Simple variable containing a function
    //
    
    function someFunction() 
    {
    }
    
    $functionVariable = 'someFunction';
    
    var_dump(is_callable($functionVariable, false, $callable_name));  // bool(true)
    
    echo $callable_name, "\n";  // someFunction
    
    //
    //  Array containing a method
    //
    
    class someClass {
    
      function someMethod() 
      {
      }
    
    }
    
    $anObject = new someClass();
    
    $methodVariable = array($anObject, 'someMethod');
    
    var_dump(is_callable($methodVariable, true, $callable_name));  //  bool(true)
    
    echo $callable_name, "\n";  //  someClass::someMethod
    
    ?> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was thinking about this today and I realized I don't have a clear
I'm thinking today at the following scenario: I have two classes A and B.
Today I was thinking about how Android framework works, and I'm not sure about
Came by a curious case today, that got me thinking about how the object
Im thinking this is correct, but probably WAY off. I have a string formatted
I was thinking today, as I linked a webpage to 3 external .css files:
I'm trying to select all objects in the articles table, and have them grouped
I was thinking many times, now days that we have Linq and other CLR
Here is my problem: The Problem I have created Tabs using jQuery which is
Given a set of tuple classes in an OOP language: Pair, Triple and Quad,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.