-3

我在 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 ";
    ?>
4

3 回答 3

2

你忘了分号。

print "...";
于 2013-10-14T09:58:46.427 回答
0

换行:

print "\n associative arrays"

至:

print "\n associative arrays";
于 2013-10-14T09:59:48.153 回答
0

后面加分号

print "\n associative arrays";
于 2013-10-14T09:59:52.290 回答