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

5
  • Not reproducible Maybe you are missing a semicolon or comma or any braces above the sum declaration. Commented Jan 8, 2022 at 5:46
  • @nice_dev but see did i missed any semicolon ,comma or braces !! Commented Jan 8, 2022 at 5: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. Commented Jan 8, 2022 at 6:05
  • The code as presented compiles and runs successfully. It also does not have 40 lines. Check it again, something doesn't match up. Commented Jan 8, 2022 at 6:06
  • 1
    yes now it's working properly thanks :) @nice_dev Commented Jan 8, 2022 at 6:32

1 Answer 1

0

Try this:

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

Sign up to request clarification or add additional context in comments.

1 Comment

I highly doubt this will solve the OP's problem, as the use of the "printf" is probably a requirement of the homework.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.