Surah 18, verse:
7. Verily! We have made that which is on earth as an adornment for it, in order that We may test them (mankind) as to which of them are best in deeds. [i.e.those who do good deeds in the most perfect manner, that means to do them (deeds) totally for Allah's sake and in accordance to the legal ways of the Prophet ].
8. And verily! We shall make all that is on it (the earth) a bare dry soil (without any vegetation or trees, etc.).
9. Do you think that the people of the Cave and the Inscription (the news or the names of the people of the Cave) were a wonder among Our Signs?
10. (Remember) when the young men fled for refuge (from their disbelieving folk) to the Cave, they said: "Our Lord! Bestow on us mercy from Yourself, and facilitate for us our affair in the right way!"
11. Therefore We covered up their (sense of) hearing (causing them, to go in deep sleep) in the Cave for a number of years.
12. Then We raised them up (from their sleep), that We might test which of the two parties was best at calculating the time period that they had tarried.
13. We narrate unto you (O Muhammad ) their story with truth: Truly! They were young men who believed in their Lord (Allah), and We increased them in guidance.
14. And We made their hearts firm and strong (with the light of Faith in Allah and bestowed upon them patience to bear the separation of their kith and kin and dwellings, etc.) when they stood up and said: "Our Lord is the Lord of the heavens and the earth, never shall we call upon any ilah (god) other than Him; if we did, we should indeed have uttered an enormity in disbelief.
15. "These our people have taken for worship aliha (gods) other than Him (Allah). Why do they not bring for them a clear authority? And who does more wrong than he who invents a lie against Allah.
16. (The young men said to one another): "And when you withdraw from them, and that which they worship, except Allah, then seek refuge in the Cave, your Lord will open a way for you from His Mercy and will make easy for you your affair (i.e. will give you what you will need of provision, dwelling, etc.)."
17. And you might have seen the sun, when it rose, declining to the right from their Cave, and when it set, turning away from them to the left, while they lay in the midst of the Cave. That is (one) of the Ayat (proofs, evidences, signs) of Allah. He whom Allah guides, is rightly guided; but he whom He sends astray, for him you will find no Wali (guiding friend) to lead him (to the right Path).
18. And you would have thought them awake, while they were asleep. And We turned them on their right and on their left sides, and their dog stretching forth his two forelegs at the entrance [of the Cave or in the space near to the entrance of the Cave (as a guard at the gate)]. Had you looked at them, you would certainly have turned back from them in flight, and would certainly have been filled with awe of them.
19. Likewise, We awakened them (from their long deep sleep) that they might question one another. A speaker from among them said: "How long have you stayed (here)?" They said: "We have stayed (perhaps) a day or part of a day." They said: "Your Lord (Alone) knows best how long you have stayed (here). So send one of you with this silver coin of yours to the town, and let him find out which is the good lawful food, and bring some of that to you. And let him be careful and let no man know of you.
20. "For if they come to know of you, they will stone you (to death or abuse and harm you) or turn you back to their religion, and in that case you will never be successful."
21. And thus We made their case known to the people, that they might know that the Promise of Allah is true, and that there can be no doubt about the Hour. (Remember) when they (the people of the city) disputed among themselves about their case, they said: "Construct a building over them, their Lord knows best about them," (then) those who won their point said (most probably the disbelievers): "We verily shall build a place of worship over them."
22. (Some) say they were three, the dog being the fourth among them; (others) say they were five, the dog being the sixth, guessing at the unseen; (yet others) say they were seven, the dog being the eighth. Say (O Muhammad ): "My Lord knows best their number; none knows them but a few." So debate not (about their number, etc.) except with the clear proof (which We have revealed to you). And consult not any of them (people of the Scripture, Jews and Christians) about (the affair of) the people of the Cave.
23. And never say of anything, "I shall do such and such thing tomorrow."
24. Except (with the saying), "If Allah will!" And remember your Lord when you forget and say: "It may be that my Lord guides me unto a nearer way of truth than this."
25. And they stayed in their Cave three hundred (solar) years, and add nine (for lunar years).
26. Say: "Allah knows best how long they stayed. With Him is (the knowledge of) the unseen of the heavens and the earth. How clearly He sees, and hears (everything)! They have no Wali (Helper, Disposer of affairs, Protector, etc.) other than Him, and He makes none to share in His Decision and His Rule.