• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add a function to the array helper

#1
Lightbulb 
Hello CI team and community!

How about add a function to the array helper?

PHP Code:
if ( ! function_exists('array_combine_different'))
{
    
/**
     * Array Combine Different
     *
     * Returns an array combined from two different length arrays
     * with keys as the first array and values as the second array.
     *
     * @param    array
     * @param    array
     * @return    array    combined array
     */
    
function array_combine_different(array $arr1, array $arr2)
    {
        
$length mincount($arr1), count($arr2) );

        
$arr1 array_slice($arr10$length);

        
$arr2 array_slice($arr20$length);

        return 
array_combine($arr1$arr2);
    }

Reply

#2
You can add it yourself.

Just create a MY_array_helper.php and add your method to it.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
(03-30-2018, 12:48 PM)InsiteFX Wrote: You can add it yourself.

Just create a MY_array_helper.php and add your method to it.

Yes, I understand it. But I think that this function can be helpful for CI community and this topic can generate new helpful ideas for CI helpers.
Reply

#4
Then you should post it in the CodeIgniter 3X forum topics.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.