News Feed
Sections
News Archive


Community Events
php|tek 2008 PHP Conference



feed this:

Developer Tutorials Blog:
PHP array_walk() Run an array through a function
0 comments :: posted Wednesday April 23, 2008 @ 08:47:09
voice your opinion now!

The Developer Tutorials blog has a quick example of how to use the array_walk function to maneuver through the array of your choosing and applying a callback method to each of its elements.

It’s a common sight: taking an array and running (well, walking) its elements through a particular function. Luckily, PHP provides a simple yet powerful function to overcome this: array_walk().

They include an example, giving a sample "some_function" the array_walk method uses when it's called, replacing a foreach (or other type of loop). Plus you can specify an object with the callback to run it against a method inside a class too.

tagged with: arraywalk function callback object method loop tutorial


Arnold Daniels' Blog:
Improve performace check your loops
0 comments :: posted Monday January 28, 2008 @ 12:14:00
voice your opinion now!

Arnold Daniels has a suggestion for developers out there to help improve the performance of their applications - check your loops.

So you have a script which is not performing the way you want to. The first thing you should do it try to find out what the problem is. There are some tools out there that can help you.

He mentions the profiler in Zend Studio as well as the one in XDebug. If you can't install those, however, he has another suggestion - FirePHP (a tool that can help time execution times in a simple and easy to include way.

With tools in hand, he offers a few suggestions as to what to check for and do in your applications:

  • Get the data ready before going into the loop
  • Don't do things in the loop, you can also do outside it
  • Use create_function to aid you
  • Be careful with abstraction in loops
  • Sometimes you can prevent loops altogether
  • Last resort: write an extension
tagged with: performance improve loop profile zendstudio firephp xdebug tips


book ajax job code developer pecl zend framework database conference PEAR zendframework releases release mysql package application security PHP5 cakephp

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