简体   繁体   中英

I'm new to php I'm getting this error "PHP Parse error: syntax error, unexpected '$sum' (T_VARIABLE)"

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

Try this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM