PHILADELPHIA (CBS) — When it comes to teaching, it doesn’t get too much better than Pennsylvania and New Jersey, according to a recent WalletHub study.

Pennsylvania ranks fifth overall and New Jersey ranks second, only behind New York. The First State settled for mid-place as Delaware ranks 25th overall.

READ MORE: Officials Investigating Gas Explosion Inside Home In South Philadelphia

WalletHub rankings are based on determining what states in the U.S. are teacher-friendliest (Washington, D.C., included), based on what it calls “Opportunity &  Competition” and “Academic & Work Environment.”

NCAA Coaches Among 10 Charged With Fraud And Corruption

READ MORE: Philadelphia Police ID Suspect In Deadly Shooting Of Temple Student Samuel Collington

Pennsylvania ranks 11th in “Opportunity & Competition” but fourth in “Academic & Work Environment.” Whereas, New Jersey ranks 18th and top overall in the same two categories.

In order to get to its findings, WalletHub used more than 20 weighted factors. Competitive salaries and job security were weighted more because WalletHub determines it is a very important part of teachers having a good work-life balance.

Pennsylvania ranks fourth overall in “Highest Annual Salaries.” New Jersey ranks fourth, alongside Vermont, in “Lowest Pupil-Teacher Ratio,” and it ranks second in “Best Overall System,” only behind Massachusetts.

MORE NEWS: FDA Panel Narrowly Votes To Recommend Merck's COVID-19 Pill

The worst ranking state was Arizona.