Not everyone will follow convention, so you can be assured if you are copy-pasting then you are getting a mix-and-match approach from people who do it "right" and do it "wrong" and sometimes the difference between right and wrong is a matter of opinion, lets not forget.
Also this applies to NOT only Syntax Style but also Best Practice methods for using proper WP Core functions over less preferred hack-jobs or unconventional functions to perform certain tasks.
Here are two links that can help you understand what WordPress thinks is acceptable coding standards syntactically, most of which you will find is common practice elsewhere amongst PHP developers;
Work with anything long enough and you will begin to memorize good convention, you'll also graduate from copy-pasting, more so to writing your own logic and with that you will adopt convention, standards and best practices because ultimately we want others to be able to read our
junk code just the same as you'd expect from others.