How to sync music from my iPhone to iTunes?

I have just transferred my iTunes to a new PC and now I don't have a music library there. How can I transfer music I have on my iPhone to iTunes?

Simply plug in your iPhone to your new PC and open iTunes. Something like "… Transfer purchases… " Click that, and all your purchased items will be shared with your PC. You may have to restore your iPhone for effects on your PC to take place on your iPhone.