I'm in my last semester of my master's program. One of my professors asked me if I was interested in pursuing PhD. I like to write code and learn to build software rather than learning from theory. I like the idea of research, and I know if I pursue PhD focusing on ML, I will be able to learn a lot and break into the ML/AI industry much easier than my current state. I'm only worried about not being able to earn substantially for the next 4-5 years until I complete the PhD and join the industry. Given the current state of IT market, and also being an international student who eventually wants to remain in the US, I feel, PhD might be the right choice. Can someone help me evaluate the pros and cons.
Edit:
Some additional context that I think I should have mentioned. I love the idea of pursuing PhD. I have always liked research work. I'm not considering it only as an alternative. I just don't like the idea of a prolonged study while not able to earn as much during the same period.
The main question that I am trying to answer is: Will a PhD help me in the long run? How valuable is it compared to having work experience during the same time?