How to make a PHP variable available in all pages

admin

Administrator
Staff member
I recently took a dive into wordpress, and I noticed something really unusual, When coding I noticed that a particular variable called the
Code:
$post
variable was available for me to manipulate whenever I need it, as along as my page is within the
Code:
wp-includes
,
Code:
wp-themes
or
Code:
wp-plugins
folder without me calling any external page or function.

So I started developing a site without wordpress hoping to understand the mystery behind that anomaly..

I would appreciate all help on making me understand this phenomenon. I would like to use such technique in building sites. Thanks...