call_user_method() function in PHP


The call_user_method() function call a user method on an specific object.

Note − The function is deprecated now.

Syntax

call_user_method(method, obj, params)

Parameters

  • method − Method name

  • obj − Object that method is being called on.

  • params − Array of parameters

Alternative

Since the call_user_method() deprecated in PHP 4.1.0, and removed in PHP 7.0, therefore use the following as an alternative solution −

call_user_func(array($obj, $method), $params);

Updated on: 30-Jul-2019

85 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements