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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:17:55+00:00 2026-06-04T01:17:55+00:00

In Javascript there is call() and apply() , that partially, but resolves to call_user_func()

  • 0

In Javascript there is call() and apply(), that partially, but resolves to call_user_func() and call_user_func_array() in PHP.

Now, the difference here is that we can pass a variable with call() and apply() to be used as this within the function scope.

Can I achieve something like this with PHP?

Update:

In Javascript:

var x = function(passed)
{
    return { dis : this, passd : passed };
};

console.log(x(44)); // window, 44

console.log(x.call(25, 44)); // 25, 44

.call() first parameter within the function scope, becomes this.

  • 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-04T01:17:56+00:00Added an answer on June 4, 2026 at 1:17 am

    From the PHP manual for Callbacks:

    A method of an instantiated object is passed as an array containing an object at index 0 and the method name at index 1.

    Example below:

    // Type 3: Object method call
    $obj = new MyClass();
    call_user_func(array($obj, 'myCallbackMethod'));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way that I can call a JavaScript function via css? For
Is there any way I can make Firefox call a JavaScript function in my
As we know that we can call any function of Javascript to control's event
I am aware that javascript does not allow true multidimensional arrays but you can
is there any example on using java method to call rhino-javascript function and return
In javascript, is there any different between these two: // call MyFunction normal way
In Javascript is there a function that returns the number of times that a
How one can reload the custom JavaScript file after an Ajax call is completed?
Possible Duplicate: How can I pre-set arguments in JavaScript function call? (Partial Function Application)
Is there a JavaScript call to get the list of attached events from specified

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.