Why did the Greek use a phalanx formation?
The Greeks used it because they seen the effectiveness of its formation after being defeated by the Macedonians under Phillip. And as the other answerers stated, it was a ‘turtle’ formation with long spears protruding forward. The warriors in the back could press forward as they attacked or were attacked. The demise of the phalanx at the hands of the Romans took advantage of its weakness, ie, it was clumsy and and lacked mobility to meet flank or rear attacks. But frontal attacks, it proved invincible.