Fastest Insertion Sort in PHP


$numbers = array(2,3,4,5,1,8,11,0);
$count = count($numbers);
 
for($i=1;$i<$count;$i++){
	$j=$i-1;
	$key = $numbers[$i];
	while($j>=0 && $numbers[$j] >  $key){
		$numbers[$j+1] = $numbers[$j];
		$numbers[$j]= $key;
		$j= $j-1;		
	}
}
print_r($numbers);
  • Share/Bookmark

10 Principles of the PHP Masters


With PHP’s widespread adoption,it’s almost too easy to find a script or snippet to do exactly what you need. Unfortunately, there’s no filter as to what is a “good practice” and what’s, well… not so good when writing a PHP script. We need trustworthy sources, who have proven they have a solid grasp on the best practices of PHP.

We need PHP masters to show us the best principles to follow for high-grade PHP programming.

(more…)

  • Share/Bookmark

Sieve of Eratosthenes in PhP


Prime Numbers: Positive natural numbers which has exactly two distinct natural number divisors 1 and itself.

Sieve Of Eratosthenes is a computer algorithm to find out prime numbers upto a specified integer starting from 2.
The time complexity of a unfaithful sieve is Θ(n2/(log n)2) ( regardless of what wikipedia might say :( )

(more…)

  • Share/Bookmark

Basic dead lock example


A deadlock is a situation wherein two or more competing actions are waiting for the other to finish, and thus neither ever does. It is often seen in a paradox like ‘the chicken or the egg‘.

(more…)

  • Share/Bookmark

Hello Lamp-World !


Welcome to the world of LAMP.

For all you disgraceful people who don’t know what it is, the definition:

L = > Linux ( Its an operating system )
A => Apache ( Its a web server )
M => MySQL ( Its a database system )
P => PhP {&perl } ( These are programming languages )

Wiki page: http://en.wikipedia.org/wiki/LAMP_(software_bundle)

We, here, at Lamp-World are group of people who live eat and think lamp.  This site is aimed to have a collection of amazing ’scripts’ , ‘tweaks’ and ’solutions’ which you may not find anywhere else.

  • Share/Bookmark