The ideal gas law is a simple equation relating pressure, temperature, and volume of a gas: a gas that follows the equation is termed an ideal gas. Real gases generally act in this manner through some regime of temperature and pressure, but fall away from it in others. It is a simple-but-useful equation of state.
PV = nRT
R depends upon the unit used for n, which can be the number of particles, in which case, R is the Boltzmann constant (k). Alternately, n can be the number of moles (the number of particles multiplied by Avogadro's number (NA), 1.38066 × 1023), a number used in chemistry to relate numbers of particles to grams), in which case R must be analogously adjusted and is known as the universal gas constant (8.3145 joule (J)/mol K).
The ideal gas law was developed (indirectly) from experimental data. It can now be derived using physics, but assuming some simplifications, which are approximately true under some regimes. In effect, it presumes the gas is monatomic (i.e., not molecules such as H2) and is a better approximation when the gas is hot enough to keep it that way, which is true of much of the gas in stars, and the ideal gas law is used in modeling them. Gases not in such a regime may still approximately adhere to the ideal gas law to some extent. Under extreme densities, quantum-mechanical effects (degeneracy) radically change the behavior.