语法错误,意外' $ arr' (T_VARIABLE)??为什么这个错误

时间:2013-10-14 09:57:21

标签: php

我在php中收到此错误。谁能帮忙!!它说

  

意外'$ arr'(T_VARIABLE)

。什么是T_variable ??

<?php $d=date("D"); if ($d=="Fri") echo "Have a nice weekend!"; else echo "Have a nice day!"; 
    print "\nday is $d"; 

    $array = array( 1, 2, 3, 4, 5); foreach( $array as $value ) { echo "Value is $value <br />"; }

    print "\n associative arrays"


    $arr = array( 
                     "key1" => value1,
                     "key2"=> value2,
                     "key3"=> value3
                    );

        echo "printing out";

        //foreach($arr as $value)
         //echo "$value ";
    ?>

3 个答案:

答案 0 :(得分:2)

你忘记了分号。

print "...";

答案 1 :(得分:0)

更改行:

print "\n associative arrays"

到:

print "\n associative arrays";

答案 2 :(得分:0)

之后添加分号
print "\n associative arrays";