Sunday, June 3, 2018

php - Parse error: syntax error, unexpected '[' How to fix this one?




I'm trying to initialize a function of CI in my native code.



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

);


I'm getting an error of
Parse error: syntax error, unexpected '['



Can I ask how to fix this?



Using Php 5.3.3


Answer





You are using PHP 5.3. The Array Initialization Construct: [] will not work. Instead, use this approach:




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

)
);

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...