It's probably more of a PHP question, but I would like to know if there are any differences in using
global $post; echo $post->ID;
when compared to
to access the ID of a post in WordPress.
This answer on SO suggests that the first method is quicker to process, while the second method is quicker to write.
I also noticed that the first method is often mentioned in the Codex while the second method is mentioned on
the_content filter page.
Is this only a matter of preference? Or does it come to performance and security too?