Shortly before learning programming I attended and completed a typewriter ("10 finger writing") course - although my results were rather average at that time my skills improved drastically later and were a crucial base to everything that followed, up to today.
I started learning programming by choosing the optional subject "computer science", so it was done thru teachers, lessons, tasks, homework and tests. It hit a nerve and I instantly started doing it privately as well. Analyzing existing code, copying parts and modifying them, seeing how others did it and reading books was the way to go in the pre 2000 era. Internet was a minor resource.
I started learning PHP as a job trainee ~7 years later, and my previous understanding of programming languages, HTML, CSS, windows, command prompts, file systems, operating systems helped me grasping it more easily, while also hardening my existing knowledge. Again I had teachers, lessons, tasks, homework and tests. Again I did it privately again, and with that I also learnt about HTTP which backlashed into the other languages I use. As said by others, the PHP manual
is the best resource, as for every function/aspect it also comes with examples and comments.