Detailed Guide On Arrays In PHP  Hot PDF Print E-mail
Tag it:
Delicious
Furl it!
Digg
NewsVine
Reddit
YahooMyWeb
Technorati
Articles Reviews PHP
Written by haroon   
Friday, 09 February 2007

{mos_sb_discuss:37}

Good Day!

Here is yet another article of Fast PHP Articles Series. Today we are going to discuss ARRAYS. We will learn its syntax, its different types, the different built-in array functions that help to perform different tasks related to arrays quickly and different practical examples explaining the use of arrays in PHP.

By the end of this article you should be able to:

- Define Arrays
- Use different types of Arrays
- Use different Built-in functions related to Arrays e.g list(), each(), var_dump, print_r, var_export()

- Write basic as well as complex php code using Arrays.
- Working with multidimensional arrays
- Understanding Foreach loop with the help of different examples

 


But before we discuss arrays let me tell you a very interesting story.

I have a DVD shop near my office that keep a very good collection of English movies. You can find movies on almost all genres e.g action movies, horror movies, romantic movies (hhhhh - ‘deep breath’), dramas, stage plays, religious movies and so on….

The shop-owner is not a very educated person but still he is able to manage the 20,000 plus DVDs very easily and he can take out the movie as soon as you say its name… hmm, the point is that how does he do that?

Well, I have analyzed his strategy and let me disclose this big secret to oraganize bunch of items with a special method to handle them easily.

He has categorized all the DVDs into different genres as we discussed above and also has given special IDs / codes / numbers to different shelves in his shop. He keeps the related movies in the same shelves. Each shelf is labeled after the category name e.g Romantic Movies, Horror Movies etc etc… Each DVD has a unique ID that can be used to track that DVD.

When a customer asks for a movie say Double Team, he quickly moves to the shelf labeled as Action Movies, then to the ROW labled as ‘D’ which means movies names starting with ‘D’ and then quickly reaches to the sequence of ‘D’ followed by ‘O’ and gets to the DOUBLE TEAM movie. And he memorizes the IDs of famous DVDs so when you ask him he will tell you pick the DVD # xxxx from shelf labeled by THIS NAME and you can directly pick it from there.



Read more

 


User reviews

There are no user reviews for this item.

Add new review




Powered by jReviews

Last Updated ( Sunday, 11 February 2007 )
 
< Prev   Next >