开发者

unexpected T_DOUBLE_ARROW PHP

I have a problem which i do not see on line 9 of my code (which is the second line for you guys). I searched stackoverflow for it, but the problem still seems to be hiding for me...

Code is:

$otsi_array(
    'soiduki_tuup' => array(
        ''                      => 'Kõik',
        '4X4'                   => '4X4',
        'Kaubik C'              => 'Kaubik C',
        'MAHTUNIVERSAAL'   开发者_运维问答     => 'MAHTUNIVERSAAL',
        'Motoroller'            => 'Motoroller',
        'Sõiduauto'             => 'Sõiduauto',
        'Traktor'               => 'Traktor',
        'Veoauto'               => 'Veoauto'
    );

All help is appreciated.


Pay attention to the syntax...

<?php
$otsi_array = array (
    'soiduki_tuup' => array (
        ''                      => 'Kõik',
        '4X4'                   => '4X4',
        'Kaubik C'              => 'Kaubik C',
        'MAHTUNIVERSAAL'        => 'MAHTUNIVERSAAL',
        'Motoroller'            => 'Motoroller',
        'Sõiduauto'             => 'Sõiduauto',
        'Traktor'               => 'Traktor',
        'Veoauto'               => 'Veoauto'
        )
    );
?>


You're missing an array declaration:

$otsi_array = array(
    'soiduki_tuup' => array(
        ...
    )
);


$otsi = array(
    'soiduki_tuup' => array(
        ''                      => 'Kõik',
        '4X4'                   => '4X4',
        'Kaubik C'              => 'Kaubik C',
        'MAHTUNIVERSAAL'        => 'MAHTUNIVERSAAL',
        'Motoroller'            => 'Motoroller',
        'Sõiduauto'             => 'Sõiduauto',
        'Traktor'               => 'Traktor',
        'Veoauto'               => 'Veoauto'
    );

Or $otsi_array = array( /* .. */ );.


When you use a variable name followed by brackets, $otsi_array() in your case, PHP will treat it as "Call the function or object named in the variable, using whatever is between the brackets as parameters". The syntax between your brackets is illegal as an argument to pass to a function, so PHP throws the error.

It should be:

$otsi_array = array(
    'soiduki_tuup' => array(
        ''                      => 'Kõik',
        '4X4'                   => '4X4',
        'Kaubik C'              => 'Kaubik C',
        'MAHTUNIVERSAAL'        => 'MAHTUNIVERSAAL',
        'Motoroller'            => 'Motoroller',
        'Sõiduauto'             => 'Sõiduauto',
        'Traktor'               => 'Traktor',
        'Veoauto'               => 'Veoauto'
    )
);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜