Array callback must have exactly two elements

Description

An array callback is an array that is used as a callback function. That structure is needed when using a method, static or not, as a callback: indeed, it requires an object or a class name, and the method name. It also does not need more elements, so two are sufficient.

Example

<?php

$a = array('a', 'b', 'c');
$a();

$e = array('d');
$e();

?>

Solutions

  • Remove any extra elements in the array, to have only two elements.

  • Add any missing elements in the array, up to two elements.