Mark Wahlberg has earned his high school diploma.

The 42-year-old actor, who dropped out of school when he was a teenager, secretly been taking classes online last year and graduated over the summer.

The 'Pain & Gain' star shared his story with the Huffington Post on Monday (09.16.13), writing: "I never made it past the ninth grade. My circumstances were not unlike millions of other teens today, who live in tough working class neighborhoods surrounded by drugs, violence and crime, and who struggle to stay on the right path without positive influences.

"Most high school dropouts don't end up with successful careers in Hollywood. I was lucky. Compared with high school graduates, dropouts are more likely to be unemployed, in poor health, living in poverty or on public assistance."

He added: "For almost a year, I've been taking classes and studying any chance I could get -- on the set, traveling for work and at home. It has been both humbling and challenging, but I'm happy to report that I am officially a high school graduate, having received my diploma this summer."

The actor, who has four children with his wife Rhea Durham, is now hoping to help other young people graduate via his charity, the Mark Wahlberg Youth Foundation.

He wrote: "To those students struggling every day and - most importantly -- to those who are looking for a second chance, I have a message for you: never give up. Keep believing in yourselves and don't make small plans. You are not alone. I can now look at my kids every day knowing that I didn't just do this for me -- I did it for them, and I did it for all the other teens and adults who have inspired me by their commitment to graduate."