Analysis error: syntax error, unexpected '[' How to fix this?

I am trying to initialize a CI function in my own code.

$cipher->initialize(
        [
         'driver'=>'openssl',
         'key' => $key
        ]
     );

I get an error. Error parsing: syntax error, unexpected '['

May I ask how to fix this?

Using Php 5.3.3

+4
source share
3 answers

You are using PHP 5.3. Array initialization construct: []will not work. Use this approach instead:

    <?php

        $cipher->initialize(
                array(
                 'driver'=>'openssl',
                 'key' => $key
                )
        );
+12
source

Your version of PHP does not support []instead array().

+4
source

[], :

 <?php

        $cipher->initialize(
                array(
                 'driver'=>'openssl',
                 'key' => $key
                )
        );
0

Source: https://habr.com/ru/post/1660894/


All Articles