|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-09-02 08:16 UTC] 131 dot php at cloudyks dot org
Description: ------------ Lot of my code will break due to PHP 5.5-5.6 array_column current behavior. This has been fixed in 7.0.0 "Added the ability for the input parameter to be an array of objects. ". Is there some way for php 5.6 to backport this behavior ? (as the function is defined, it does not allow my code to override it anymore, as in php <= 5.4) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 16:00:01 2025 UTC |
> This has been fixed in 7.0.0 It has not been fixed, but rather an improvement has been made to the function, and improvements are usually not backported. > as the function is defined, it does not allow my code to > override it anymore, as in php <= 5.4 In my opinion, it is always problematic to use polyfills. Consider to use wrappers instead. Something like: <?php function my_array_column(…) { if (function_exists('array_column') && version_compare(phpversion(), '7.0.0', '>')) { return array_colum(…); } else { // fallback code } } For efficiency, the conditional could be put outside of the function definition.