What is a correct way to use
array_splice
in PHP? The function header clearly says:array_splice ( array &$input , int $offset...
so it should accept reference as a first argument.However, a line
array_push(&$this->contextsIds, $contextId);
Triggers an error Deprecated: Call-time pass-by-reference has been deprecated in ... line 132
How do I return a reference to an array? I have:
public function &getContextsIds() { return is_array($this->contextsIds) ? $this->contextsIds : array(); }
but it says Notice: Only variable references should be returned by reference
is_array()
。 - BoltClock