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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:16:36+00:00 2026-05-26T00:16:36+00:00

I was browsing SO and found this hosted code as a recommended way of

  • 0

I was browsing SO and found this hosted code as a recommended way of cutting down on PHP code.

https://github.com/jamierumbelow/codeigniter-base-model

So far, from the methods that I have figured out how to use, I love what it does and how simple it makes things.

However, in the following code:

/**
 * Get a single record by creating a WHERE clause by passing
 * through a CI AR where() call
 *
 * @param string $key The key to search by 
 * @param string $val The value of that key
 * @return object
 */
public function get_by() {
    $where =& func_get_args();
    $this->_set_where($where);

    $this->_run_before_get();
    $row = $this->db->get($this->_table)
                    ->row();
    $this->_run_after_get($row);
    return $row;
}

I’m not exactly sure how to make a call to this function.
The description of what it does is exactly what I want to do.

The @params say it takes in a key and value pair for the WHERE block but I don’t see any function inputs in the method signature.

Help, please?

  • 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-26T00:16:37+00:00Added an answer on May 26, 2026 at 12:16 am

    As I’m noticing with a lot of CI code, it’s strange and maintenance un-friendly.

    PHP functions can accept n or more arguments (where n is the number of arguments defined in the signature)

    The code makes use of func_get_args() which returns an array of arguments.

    The array of arguments is then passed to the _set_where() method which passes either one or two items to the db->where() method.

    A more descriptive method signature would have been

    public function get_by($key, $val = null)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Browsing through the source code of Microsoft's sample StockTrader application, I found this snippet
While browsing questions and answers in this forum i found a piece of code
I found this code for a generic DAO interface while browsing around: public interface
While browsing some code I found a call to OpenPrinter() . The code compiles
When browsing ASP.NET MVC source code in codeplex , I found it is common
I was browsing the web and found this site . I noticed how the
While browsing System.Zip (Delphi XE2) to see how it works, I found this function:
I'm browsing the source code of StyleCop , and I found a curious thing:
I found by browsing some pages source code that they resize a box using
This is the situation: I'm browsing through some code and I wondered if the

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.