News Feed
Sections




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

Leve.rs:
Array Manipulation in PHP, the Correct Way
November 08, 2013 @ 10:08:04

On the Leve.rs blog there's a recent post showing what they consider is the right way to work with arrays in PHP. It shows three things you can do to use PHP's own functionality to more correctly perform some common array operations.

More often than not, when PHP developers debug others' code, the majority of each method is taken up by array manipulations. Spending this much time on array manipulations is a huge hassle when trying to understand any given method. In order to speed up the debugging process, it's important to start writing array manipulations the correct way, first. Here are a few examples of code I have either written myself or had to fix in the past. It is time every PHP developer knows how to manipulate arrays properly!

Their three tips relate to:

  • Merging Arrays
  • Array Value Manipulation (with array_walk)
  • Array Value Manipulation (append with the plus sign, "+")
0 comments voice your opinion now!
array manipulation correct merge value walk plus

Link: http://leve.rs/blog/correct-array-manipulation-in-php/

blog comments powered by Disqus

Similar Posts

PHPit.net: Image manipulation with PHP & the GD library (Part 2)

Dan Horrigan's Blog: The Value of Null

Fabien Potencier's Blog: On PHP 5.3, Lambda Functions, and Closures

Christopher Jones' Blog: Casting PL/SQL arrays as REF CURSORS for Ruby (and PHP)

Maarten Balliauw's Blog: LINQ for PHP (Language Integrated Query for PHP)


Community Events





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


series podcast laravel artisanfiles language composer introduction voicesoftheelephpant conference version list library security symfony interview release tool framework opinion community

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