The For loops are declared incorrectly. Instead of commas (,) you should use semicolons ( between the loop parameters. So for instance, your for loop should look like this: Code: for ($i = $tempArrSize; $i > 0; $i--){......}