0

This is the code


<?php


$sum=1+1;
$sub=1-1;
$div=1/1;
$mult=1*1;
printf("SUM:%d\nSUB:%d\nDIV:%d\nMULTI:%d\n",$sum,$sub,$div,$mult);

?>

ERROR:

PHP Parse error: syntax error, unexpected '$sum' (T_VARIABLE) in /var/labsstorage/home/Jaswanth/files/test.php on line 40

jaswanth
  • 29
  • 1
  • 1
  • 8
  • [`Not reproducible`](https://onecompiler.com/php/3xpqwbyz3) Maybe you are missing a semicolon or comma or any braces above the sum declaration. – nice_dev Jan 08 '22 at 05:46
  • @nice_dev but see did i missed any semicolon ,comma or braces !! – jaswanth Jan 08 '22 at 05:49
  • If you actually haven't, then how are you getting this error? Did you see my attached link in the previous comment? The code you showed in your question doesn't produce any error on our end. – nice_dev Jan 08 '22 at 06:05
  • The code as presented compiles and runs successfully. **It also does not have 40 lines.** Check it again, something doesn't match up. – UncaAlby Jan 08 '22 at 06:06
  • 1
    yes now it's working properly thanks :) @nice_dev – jaswanth Jan 08 '22 at 06:32

1 Answers1

0

Try this:

echo "SUM:".$sum."SUB:".$sub."DIV:".$div."MULTI:".$mult;

Anowar Hosen
  • 145
  • 1
  • 10
  • I highly doubt this will solve the OP's problem, as the use of the "printf" is probably a requirement of the homework. – UncaAlby Jan 08 '22 at 06:08