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
A parse error: syntax error, unexpected appears when the PHP interpreter detects a missing element. Most of the time, it is caused by a missing curly bracket “}”. To solve this, it will require you to scan the entire file to find the source of the error.
If the PHP code contains a syntax error, the PHP parser cannot interpret the code and stops working. For example, a syntax error can be a forgotten quotation mark, a missing semicolon at the end of a line, missing parenthesis, or extra characters.
Parse Error (Syntax) Parse errors are caused by misused or missing symbols in a syntax. The compiler catches the error and terminates the script. Parse errors are caused by: Unclosed brackets or quotes. Missing or extra semicolons or parentheses.
You are using PHP 5.3. The Array Initialization Construct:
[]
will not work. Instead, use this approach:
<?php
$cipher->initialize(
array(
'driver'=>'openssl',
'key' => $key
)
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With