All the world's a stage

"All the world's a stage" is the phrase that begins a monologue from William Shakespeare's pastoral comedy As You Like It, spoken by the melancholy Jaques in Act II Scene VII Line 139. The speech compares the world to a stage and life to a play and catalogues the seven stages of a man's life, sometimes referred to as the seven ages of man.
The comparison of the world to a stage and people to actors long predated Shakespeare. Richard Edwards' play Damon and Pythias, written in the year Shakespeare was born, contains the lines, "Pythagoras said that this world was like a stage / Whereon many play their parts; the lookers-on, the sage". When it was founded in 1599 Shakespeare's own theatre, The Globe, may have used the motto Totus mundus agit histrionem (All the world plays the actor), the Latin text of which is derived from a 12th-century treatise. Ultimately the words derive from quod fere totus mundus exercet histrionem (because almost the whole world are actors) attributed to Petronius, a phrase which had wide circulation in England at the time.
In his own earlier work, The Merchant of Venice, Shakespeare also had one of his main characters, Antonio, comparing the world to a stage:
In his work The Praise of Folly, first printed in 1511, Renaissance humanist Erasmus asks, "For what else is the life of man but a kind of play in which men in various costumes perform until the director motions them off the stage."
Likewise the division of human life into a series of ages was a commonplace of art and literature, which Shakespeare would have expected his audiences to recognize. The number of ages varied: three and four being the most common among ancient writers such as Aristotle. The concept of seven ages derives from ancient Greek philosophy. Solon, the Athenian lawgiver, described life as 10 periods of 7 years in the following elegiac verses:
"In seven years from th' earliest breath, The child puts forth his hedge of teeth; When strengthened by a similar span, He first displays some signs of man. As in a third, his limbs increase, A beard buds o'er his changing face. When he has passed a fourth such time, His strength and vigour's in its prime. When five times seven years o'er his head Have passed, the man should think to wed; At forty two, the wisdom's clear To shun vile deed of folly or fear: While seven times seven years to sense Add ready wit and eloquence. And seven years further skill admit To raise them to their perfect height. When nine such periods have passed, His powers, though milder grown, still last; When God has granted ten times seven, The aged man prepares for heaven."
In Psalm 90, attributed to Moses, it is also written, "Our days may come to seventy years, or eighty, if our strength endures; yet the best of them are but trouble and sorrow, for they quickly pass, and we fly away."
The Jewish Philosopher Philo of Alexandria writes in his work 'On Creation': "Hippocrates the physician says that there are Seven ages of man, infancy, childhood, boyhood, youth, manhood, middle age, old age; and that these too, are measured by periods of seven, though not in the same order. And he speaks thus; ``In the nature of man there are seven seasons, which men call ages; infancy, childhood, boyhood, and the rest. He is an infant till he reaches his seventh year, the age of the shedding of his teeth. He is a child till he arrives at the age of puberty, which takes place in fourteen years. He is a boy till his beard begins to grow, and that time is the end of a third period of seven years. He is a youth till the completion of the growth of his whole body, which coincides with the fourth seven years. Then he is a man till he reaches his forty-ninth year, or seven times seven periods. He is a middle aged man till he is fifty-six, or eight times seven years old; and after that he is an old man."
Because of such sanctity in the number seven, Philo says, Moses wrote of the creation of the world in seven stages. In medieval philosophy as well, seven was considered an important number, as for example the seven deadly sins. King Henry V had a tapestry illustrating the seven ages of man.
According to T. W. Baldwin, Shakespeare's version of the concept of the ages of man is based primarily upon Pier Angelo Manzolli's book Zodiacus Vitae, a school text he might have studied at the Stratford Grammar School, which also enumerates stages of human life. He also takes elements from Ovid and other sources known to him. In fact, Shakespeare developed the idea of all the world being a stage by reading the epigrams of Palladas the Cynic, whose work pre-dated all the sources cited above.