Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
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
[]
$cipher->initialize( array( 'driver'=>'openssl', 'key' => $key ) );
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 ) );
Add a comment
Your PHP version doesn't support [] use array() instead.
array()
Don't use [], Use:
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
[]may or may not work. Try:$cipher->initialize( array( 'driver'=>'openssl', 'key' => $key ) );instead (since you are using PHP 5.3).