Because of this: $i=($num_dates-1) You need to check the condition ==, not use an assignment =. Although in this case it appears you want to do something like this: $i <= ($num_dates-1). You may have just forgot to type <.
1
solved Formatting php for-loop