The variational and fractional-dimensional space approaches are used in a thorough study of the virial theorem value and scaling of the shallow-donor binding energies versus donor Bohr radius in GaAs/(Ga,Al)As semiconductor quantum wells (QWs) and quantum-well wires (QWWs). In the case of the fractional-dimensional space approach, in which the three-dimensional actual anisotropic semiconductor heterostructure is modelled by a fractional-dimensional isotropic effective medium, we have shown that if the ground-state wave function may be approximated by a D-dimensional hydrogenic wave function, the virial theorem value equals 2 and the scaling rule for the donor binding energy versus Bohr radius is hyperbolic, both for GaAs/(Ga,Al)As wells and wires. In contrast, calculations within the variational scheme show that the scaling of the donor binding energies with quantum-sized Bohr radius is in general nonhyperbolic and that the virial theorem value is nonconstant. Moreover, calculations for the donor binding energies versus well widths or wire radii, within both the fractional-dimensional and the variational approaches, indicate that any general conclusion based on a given virial theorem value or donor energy versus Bohr radius scaling rule should be examined with caution.