0

No more referenced array functions

Some array functions (sort, array_unshift...) operate with referenced variables. ```php $initArray = array(); array_unshift($initArray, 'foo'); var_dump($initArray); //array('foo') ``` They therefore needed to work with variables, and require sometimes instantiate unnecessary variables. ```php error_reporting(E_ALL|E_STRICT); function getArray(){ return array(); } array_unshift(getArray(), 'foo'); //Strict Standards: Only variables should be passed by reference ``` Furthermore, if you not want to impact the initial array, it must be duplicated in anonther variables. ```php $initArray = array(); $modArray = $initArray; //duplication... array_unshift($modArray, 'foo'); ``` And some don't... we need to remember which is which... It causes trouble. ```php $initArray = array(); array_pad($initArray, 1, 'foo'); var_dump($initArray); //no modification... ``` So, align array methods on a standard behavior without reference.
HorrorkidIP ยท 2 months ago