phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

emulating array_map() function


 
Search this topic... | Search General Support... | Search Box
Register or Login to Post    Index » General Support  Previous TopicPrint TopicNext Topic
Author Message
khofech
Board Member



Joined: 27 Feb 2009

Posts: 44



PostPosted: Tue Mar 03, 2009 5:57 am 
Post subject: emulating array_map() function

hi guys (you know the rest icon_wink.gif ) , I'm using an old php version (4.0.5) (please don't tell me to update my version) and when installing the last version of attachement mod by acydburn, there is a mistake that always happen wich is unknow or undeclared function array_map , when asking in official phpbb forum before the v2 support retirement, they say that it's a php function and I'm maybe using an absolete php version (evident no ? loool ) , ok, what I need , is a gentelman who can give me a function that emulate array_map so I can insert it in common.php or function.php without need to update my php version (please , I have logic excuse for that -> I have a stoneage connection and downloading a megabyte may take me a centry beleive me), so..... is there a gentelman ? icon_wink.gif
Back to top
Ptirhiik
Board Member



Joined: 19 Nov 2008

Posts: 114


flag
PostPosted: Tue Mar 03, 2009 6:24 am 
Post subject: Re: emulating array_map() function

Basicaly, array_map() applies a function to each rows of an array, eg:

Code:
// $func: string: function name to apply, ie 'strtoupper'
// $ary: array: array of data
function array_map($func, $ary)
{
   if ( !$ary || !is_array($ary) )
   {
      return false;
   }
   foreach ( $ary as $key => $value )
   {
      $ary[$key] = $func($value);
   }
   return $ary;
}


This is of course a simplified version of the array_map(), as the $func parameter could be itself an array containing a class or an object plus a method of this class/object - or even a created-on-the-fly function, what is not handled there. But as far as I remember, it should be ok for the attachment mod. However, I'm not sure it is the only incompatibility you may encounter with php 4.0. Nobody has suggest you to upgrade your php version ? (oh ok, just shoot me icon_biggrin.gif)
Back to top
khofech
Board Member



Joined: 27 Feb 2009

Posts: 44



PostPosted: Tue Mar 03, 2009 10:04 am 
Post subject: Re: emulating array_map() function

Thanx gentleman.
Will try it when in back to my house, hope it'll work.
And hope i'll get a newer php version and new mysql Version too (cause of miss of union in v 3 =>think i'll post a topic on how to replace union statement lool).
Back to top
khofech
Board Member



Joined: 27 Feb 2009

Posts: 44



PostPosted: Tue Mar 03, 2009 2:58 pm 
Post subject: Re: emulating array_map() function

Ok gentleman ram
i just finish implemented the function, it works well and all is good....
Thanx.
I just added
Code:

if !function_exists('array_map')

so no conflict will happen if and only if i upgrade my php
Back to top
Display posts from previous:   
Register or Login to Post    Index » General Support  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0263 seconds using 15 queries. (SQL 0.0023 Parse 0.0008 Other 0.0232)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo