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

  • Home
  • SEARCH
  • 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 985131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:07:18+00:00 2026-05-16T05:07:18+00:00

The magic function __call() in php are used in classes. Are there any similar

  • 0

The magic function __call() in php are used in classes. Are there any similar magic function but for functions instead? Like __autoload() is for functions.

For example something like this

function __call($name, $arguments) {
    echo "Function $name says {$arguments[0]} ";
}
random_func("hello");
  • 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-05-16T05:07:19+00:00Added an answer on May 16, 2026 at 5:07 am

    Nope, I don’t think such a magic function exists.

    One workaround for this would be to put your functions into a static class, and add a __callStatic magic method to that class (> PHP 5.3 only, I’m afraid):

    class Func
     {
       /**  As of PHP 5.3.0  */
       public static function __callStatic($name, $arguments)
         {
        // Note: value of $name is case sensitive.
        echo "Calling static method '$name' "
             . implode(', ', $arguments). "\n";
    
      }
     }
    
    Func::random_func("hello!");
    

    For PHP < 5.3, you could do the same thing, but you would have to instantiate an object and use the __call magic method.

    $Func = new Func;
    $Func->random_func("hello!");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the magic __call method in PHP. Sometimes the function I call
So, I would like to use this magic find function in my CakePHP 2.0
Is there any magic tools i can use to scan source code that was
PHP uses magic quotes by default but has gotten a lot of flak for
Is there such a thing? Some kind of a magic function that allows you
Is there some way of using magic methods in Java like there is in
I've seen dozens of PHP snippets that go like this: function DB_Quote($string) { if
My question is rather simple, here is the context: http://php.net/manual/en/language.oop5.magic.php Magic Methods The function
I'm trying to make a class which has methods called using PHP's __call() magic
Other similar questions: Why I should use __get() and __set()-magic methods in php? When

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.