Anas (May Allah be pleased with him) reported:
The Messenger of Allah ﷺ said, "He who goes forth in search of knowledge is considered as struggling in the Cause of Allah until he returns."
[At- Tirmidhi].
وعن أنس رضي الله عنه قال: قال رسول الله ﷺ :
"من خرج في طلب العلم، فهو في سبيل الله حتى يرجع" رواه الترمذي وقال: حديث حسن.