We assess the performance of recent density functionals for the exchange-correlation energy of a nonmolecular solid, by applying accurate calculations with the GAUSSIAN, BAND, and VASP codes to a test set of 24 solid metals and non-metals. The functionals tested are the modified Perdew-Burke-Ernzerhof generalized gradient approximation (PBEsol GGA), the second-order GGA (SOGGA), and the Armiento-Mattsson 2005 (AM05) GGA. For completeness, we also test more-standard functionals: the local density approximation, the original PBE GGA, and the Tao-Perdew-Staroverov-Scuseria (TPSS) meta-GGA. We find that the recent density functionals for solids reach a high accuracy for bulk properties (lattice constant and bulk modulus). For the cohesive energy, PBE is better than PBEsol overall, as expected, but PBEsol is actually better for the alkali metals and alkali halides. For fair comparison of calculated and experimental results, we consider the zero-point phonon and finite-temperature effects ignored by many workers. We show how Gaussian basis sets and inaccurate experimental reference data may affect the rating of the quality of the functionals. The results show that PBEsol and AM05 perform somewhat differently from each other for alkali metal, alkaline earth metal and alkali halide crystals (where the maximum value of the reduced density gradient is about 2), but perform very similarly for most of the other solids (where it is often about 1). Our explanation for this is consistent with the importance of exchange-correlation nonlocality in regions of core-valence overlap.