PHP Array questions

1) How can I create an array of numbers easily?
If you want to create an array of consecutive numbers in PHP, then you can do it the long hand way…

$myarray = array(1,2,3,4,5,6,7);

Or you can do it the easy way, using the range function, which you simply pass the first and last value in the consecutive range. So this is equivalent to the above code:

$myarray = range(1,7);

… and when you want an array containing the numbers 1 to a 1,000 – then you’ll be glad you learned about this function!

2) How do you remove duplicate values from an array?
Duplicate values are easily removed using the array_unique function:

$values = array("banana","apple","pear","banana");
$values = array_unique($values);


[0] => banana
[1] => apple
[2] => pear

Initiating the tech blog

This blog will contain the tech things of interest to me and Dimple.

The software industry is growing rapidly conceptwise, and its becoming an information overload. This is an attempt to organize some of that information for our own personal sake.

Some of the things noted here may seem downright simple and silly.  But with the amount of things that change everyday, remembering even the simple things becomes a hard task.