News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

ProDevTips.com:
This is what's wrong with PHP
October 01, 2009 @ 08:10:43

On the ProDevTips blog today Henrik describes a situation where he "tried to be clever" with the array_map and array_filter functions and some of the confusion in their usage.

I knew array_filter existed and what it was all about since before, however I started working with something requiring array_map first, all well and OK, array_map looks like this: array_map('callback', Array). So then I assumed I could use array_filter in the same fashion, big mistake.

He was caught by the parameter order difference between the two and problems with how the callbacks worked. In the end, he he spent an hour to create a function to search an array for a partial match and didn't even end up using the array functions (opting for calls to stripos instead).

0 comments voice your opinion now!
wrong parameter order callback


blog comments powered by Disqus

Similar Posts

KillerPHP.com: Advanced PHP Video Tutorial - Passing Parameters Around an MVC Application

Felix Geisendörfer's Blog: Welcome to the Dark Side of Plugins in CakePHP

Philip Olson's Blog: 20 possible reasons why PHP function names and parameters are weird

Hasin Hayder's Blog: An interesting bug in ReflectionParameter object in PHP 5.2.1

Christopher Jones' Blog: LinuxWorld; Oracle PHP Books; NCLOBS


Community Events





Don't see your event here?
Let us know!


library framework release tips podcast package bugfix voicesoftheelephpant list series install community deployment introduction interview language laravel symfony opinion api

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework