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 1047911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:22:28+00:00 2026-05-16T16:22:28+00:00

I am not sure if the term Wildcard can explain my point, but sometimes

  • 0

I am not sure if the term “Wildcard” can explain my point, but sometimes in some ready scripts we are able to call a non defined function like find_by_age(23) where age can be anything else that’s mapped to a database table record. So i can call find_by_name, find_by_email, find_by_id and so on. So how can we do such thing either in procedural or object oriented ways ?

  • 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-16T16:22:29+00:00Added an answer on May 16, 2026 at 4:22 pm

    The term you are looking for is magic method.

    Basically like this:

    class Foo {
        public function __call($method,$args) {
            echo "You were looking for the method $method.\n";
        }
    }
    
    $foo = new Foo();
    $foo->bar(); // prints "You were looking for the method bar."
    

    For what you are looking for, you just filter out bad function calls and redirect good ones:

    class Model {
        public function find_by_field_name($field,$value) { ... }
        public function __call($method,$args) {
            if (substr($method,0,8) === 'find_by_') {
                $fn = array($this,'find_by_field_name');
                $arguments = array_merge(array(substr($method,8)),$args);
                return call_user_func_array($fn,$arguments);
            } else {
                throw new Exception("Method not found");
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not sure if I am using the correct term, but it's not child/parent since
I am not sure what the proper term is, but I am trying to
I'm not sure if 'architecture' is the correct term, but I've been looking for
I am not sure if CopyMost is the correct term to use here, but
I'm not sure if linearization is the proper term, but I need a query
I'm not sure if the word Reorganizing is the correct term, but its the
I'm not sure if drawer is the right term, but I'm wanting to find
I'm not sure scalar testing is the correct term for it but I mean
Not sure why but I am not getting anything back from the json call.
I'm not sure if bitmask is the correct term. Let me explain: In php,

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.