0

I'm trying to learn php, but when I try to compile this code

<?php

  $n = 15,32;
  $log = log ($n);

  printf ("log (%0.2f) = %.5<br>", $log);

?>

it shows me

Parse error: syntax error, unexpected ','on line 25

but when I try to compile this

<?php

  $n = 15.32;
  $log = log ($n);

  printf ("log (%0.2f) = %.5<br>", $log);

?>

it doesn't print anything. Any ideas why this happens?

LordJohn
  • 1
  • 1
  • Add [error reporting](http://php.net/manual/en/function.error-reporting.php) at the top of your file(s): `ini_set("display_errors", 1); error_reporting(E_ALL);` and you will also get a warning for the second code. Then it will be clear what you have to fix :) – Rizier123 Aug 08 '16 at 00:29
  • and for the first piece of code, php uses the period (full-stop) decimal separator for integers –  Aug 08 '16 at 00:32

0 Answers0