In physics class we learn of many laws of physics, but it is never explained what a law of physics actually is. Is it simply a true statement about the physical world? If so, then why aren't most statements of fact laws of physics?
Several answers have been given above about what a law of physics is or does or whatever.
One of them claims that laws of physics are about prediction, another claims they are a 'provisional statement of an observed regularity in Nature'.
From these statements, it follows that anything that can't be observed is not part of physics. It may be impossible to put a measuring instrument in the core of the sun, and so by this standard, physics has nothing to say about the core of the sun. We also can't measure the past because we can't travel into the past and stick measuring instruments into it, and so the whole past history of the universe is not part of physics. Anything that is spacelike separated from us also can't be measured and so is not part of the laws of physics.
There is another extremely serious problem. All of the limitations I pointed out are a consequence of the laws of physics. The laws of physics strictly forbid observations of a lot of the stuff they refer to.
Physics is not about prediction. Science in general is not about prediction. Rather, science in general is about explanation: giving an account of what is happening in reality and why it is happening. A prediction itself is such an explanation. If you can't explain what's going on in an experiment, which includes stuff you can't observe, then you can't do the experiment. Why? Because the idea that the laws of physics is about observations, if taken seriously, destroys the distinction between correct and incorrect measurements and so destroys the whole subject of measurement theory and all experimental science. This is a matter of immediate practical experimental relevance. It is not a theoretical quibble or anything like that. The dominance of the idea that science is about prediction is a serious threat to theoretical and experimental progress. Witness the pathetic, floundering confusion in physics about explaining even the simplest quantum mechanical experiments.
One of the comments claims that physics is about dynamical laws. This is not true either. The second law of thermodynamics is not a dynamical law.
For more explanations of these points see 'The Fabric of Reality' and 'The Beginning of Infinity' by David Deutsch, and also https://arxiv.org/abs/1210.7439.
A law of physics is one that tries to predict:
Previously observed experimental results.
Results of previously untried experiments.
Basically, the philosophy of a physical law is experimentation. Anything to explain empirical results (as described above), may be considered a physical law.
However, fundamental physical laws are the ones that explain (predict results) of a wide range of phenomenon with as basic mathematical structure as possible.
The philosophy of science is more-or-less: "Seeing is Believing" (within limits of experimental error).
Edit: The reason why all facts about nature are not physical laws is that their range of applicability is very limited. A law must have some significant applicability to predict results and phenomenon.
Edit: The currently accepted answer seems to imply that "explanation" is basic to physics. Isn't Newton's law of gravitation a "simpler explanation" than Einstein's theory of spacetime curvature. So why choose the latter? Because more experiments confirm Relativity. No contridiction as of now has been found to Relativity from an experimental point of view, as opposed to Newton's law. That is the only reason. Experimentation is a basic tenet to physics.
Here is a basic working definition of a law of physics from the point of view of a physicist. It does lead to several interesting philosophical questions, which I completely ignore (but am very well aware of).
A law of physics is a provisional statement of an observed regularity in Nature. We formulate laws of physics to understand the world around us, and also to control it or act in it (not always: a good deal of astronomy for example deals with things that we will never control). A law of physics summarizes many instances of a given phenomenon in a convenient manner. For example, the law of gravitation summarizes in one formula how objects fall towards the ground as well as how planets go around the Sun. An observed regularity is something that holds in many, most or all observed instances of a phenomenon. A law is always provisional in the sense that a more encompassing or more precise statement of a regularity may have to be made later, given more observations.
The laws of physics are usually numerical, holding between observable quantities that can be measured, so that the laws take a precise, mathematical form. However, there can be individual instances of measurements that do not exactly conform to the mathematical law at hand: there can be errors due to the measurement equipment or procedure, or fundamental uncertainty as in the case of quantum mechanics. This gives a statistical character to the laws of physics, and it is usually required to estimate the uncertainty in the measurements.
A very basic example, but one that is IMHO worthwhile keeping in mind as a good image of a law of physics, would be the following picture, where we have observed a number of data points, and plotted the line (model/law) that bests fits these observations. It shows what the law/model is: the line, i.e. 2 coefficients a and b in a formula y = ax + b. This line summarizes the data points, it is the regularity/invariant underlying the phenomenon. It also allows interpolation and prediction to calculate unmeasured values of y for values of x. Finally, it shows the notion of error in measurement, as many actual points lie close to the line, but not exactly on it.
Pierre Duhem—a prominent physicist, philosopher of physics, and historian of medieval physics—discusses "physical law" (which he distinguishes from "physical theory") in his Aim & Structure of Physical Theory ch. 5 pp. 165ff (French original).
Here are the subsections of that chapter:
- The laws of physics are symbolic relations.
His definition of physical law (ibid. p. 168): "A physical law is a symbolic relation whose application to concrete reality requires that a whole group of laws be known and accepted."
- A law of physics is, properly speaking, neither true nor false but approximate.
- Every law of physics is provisional and relative because it is approximate.
- Every physical law is provisional because it is symbolic.
- The laws of physics are more detailed than the laws of common sense.
cf. also ch. 10 "Physical Laws" of The Physical System of St. Thomas by G.M. Cornoldi, S.J.