The answer really depends upon what you are trying to accomplish.
There isn't any special magic in exercise order, but some reasons it may matter have to do with the available energy for exercise, the causes of muscle fatigue, and the risk of injury during exercise. In general, exercise you perform when you have adequate energy is performed at a higher intensity with more focus and efficiency. Exercise you perform when your energy supplies are low is less effective and more likely to result in injury.
Exercise order may also matter if you are trying to achieve a specific goal, such as building muscle or improving sports skills, or if you have an extremely high level of fitness already.
Exercise Order Recommendations
Most recreational athletes can avoid this question altogether by doing cardio and weight training on different days. Another option is to do both endurance and strength training at the same time with interval training or circuit training routines that give a full-body workout in limited time.
Even though there is no magic in exercise order, some things seem to work better than others. If you have specific goals, use the following advice regarding exercise order:
If Your Goal is Improving Overall Health
To improve overall health, it really doesn't matter if you lift weights first or do endurance training first. In fact, you can do both at the same time with interval training or circuit training routines or you can alternate weight lifting and endurance days if you prefer.