O'Reilly logo

Mastering Joomla! 1.5 Extension and Framework Development by Chuck Lanham, James Kennard

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Arrays

Arrays are an integral part of PHP and we constantly use them when building Joomla! extensions. PHP provides us with a number of very useful functions for working with arrays. We can use the static JArrayHelper class to simplify other common tasks when working with arrays.

The JArrayHelper class is located in the joomla.utilities.arrayhelper library. Before we can use the JArrayHelper class we must import the relevant library:

jimport('joomla.utilities.arrayhelper');

Imagine we have a CSV file, which holds records with mathematical data:

2, 4.6
0, 0.0
1, 2.5
4, 8.2

Now imagine we want to order the data by ID (the first field) and we want the values (second field) to be displayed as integers.

The first thing we need to do is retrieve the contents ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required