问答详情
源自:3-7 PHP标量类型—整型

求解答。。。。。。

<?php

"$data_int1=123;"

echo $data_int1;

echo "<br />";

"$data_int2=-123;"

echo $data_int2;

echo "<br />";

"$data_int3=0123;"

echo $data_int3;

echo "<br />";

"$data_int4=0x123;"

echo $data_int4;

echo "<br />";

?>

Parse error: syntax error, unexpected 'echo' (T_ECHO) in /54/746/IzPc/index.php on line 3

提问者:封w绣 2016-12-04 09:27

个回答

  • Java_鲜奶
    2016-12-04 10:01:16
    已采纳

    你的变量定义为什么有双引号括起来呢?把所有定义变量行的双引号去掉就可以了

    <?php

    $data_int1=123;

    echo $data_int1;

    echo "<br />";

    $data_int2=-123;

    echo $data_int2;

    echo "<br />";

    $data_int3=0123;

    echo $data_int3;

    echo "<br />";

    $data_int4=0x123;

    echo $data_int4;

    echo "<br />";

    ?>


  • DragonWarrior
    2016-12-04 10:04:32

    变量 不能使用 ""双引号,本机 修改后代码如下,已可以正常运行!

    <?php

    $data_int1=123;

    echo $data_int1;

    echo "<br />";

    $data_int2=-123;

    echo $data_int2;

    echo "<br />";

    $data_int3=0123;

    echo $data_int3;

    echo "<br />";

    $data_int4=0x123;

    echo $data_int4;

    echo "<br />";

    ?>