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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T10:05:39+00:00 2026-05-19T10:05:39+00:00

ok im learning on how to make my own custom mvc system, so far

  • 0

ok im learning on how to make my own custom mvc system, so far i have created things like router and the controller.

example i have a controller profile class and an url http://www.helloworld.com/args1/args2/args3

class Profiles
{
    function index($args1,$args2)
    {
        echo var_dump($args1,$args2);
    }
}

heres are part of my router class that execute the method and the parms

        if (is_callable(array($controller,$method))) {
            call_user_func_array(array($controller, $method), $this->params);
        }

so far no error but somehow i need to give a 404. if the $this->params is different then the count(params) in the method that i call at call_user_func_array(array($controller, $method),
$this->params);

ok what im thinking is if count get params not same as count params at the called class then 404,
lets say i can count my $this->params it gave me a 3. but how about the params in the called class ?
how can we count params in a called class by call_user_func_array?

Thanks for looking in

Adam Ramadhan

  • 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-19T10:05:39+00:00Added an answer on May 19, 2026 at 10:05 am

    From what I know, there is no way of getting the parameter count for a method without using reflection. However, it’s pretty simple and would look something like this:

    $reflector = new ReflectionClass('Profiles');
    $method = $reflector->getMethod('index');
    $parameters = $method->getParameters();
    
    printf('%s expects %d parameters', $method->name, count($parameters));
    

    Will yield

    index expects 2 parameter
    

    Note that reflection always comes with a cost. However, the performance implications of this should not be noticable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im learning asp.net mvc and have been investigating jquery and the like. As yet
I am interested in learning how I could make my own operating system. I'm
I have a small RIA that I built as a learning/make-my-life-easier project that uses
To make story short, i'm building self-learning banner management system. Users will be able
i am learning c programming. I am trying to make my own program similar
I'm experimenting/learning with java and json. I'm trying to make my own data for
So I am learning how to use streams to make files of my own
I have been using the Learning Java 2nd Edtion book to try make my
I'm learning about generics, so I'm trying to make my own generic array class,
I'm just learning Java... I have 2 custom classes. One is a Fraction and

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.