<p>The Charge plugin requires a minimum of <strong>PHP 5.4</strong>.</p>

<p>The brackets notation for arrays (which is what Charge uses) was added in 5.4.</p>

<blockquote>
  <p><a href="http://php.net/manual/en/language.types.array.php" rel="nofollow noreferrer">http://php.net/manual/en/language.types.array.php</a></p>
</blockquote>

<p>Contact your hosting provider to find out how to upgrade.</p>

CC BY-SA 3.0
2017-12-11T23:54:56.170Z
I am using PHP 5.6 it works fine yesterday but when I open it today I got that error.
ChooeyCraft
CC BY-SA 3.0
2017-12-11T23:56:06.903Z
Your post explicitly says you found a message stating "You are using PHP 5.3." I'd recommend you check again.
Lindsey D
CC BY-SA 3.0
2017-12-11T23:58:23.320Z
Sorry about that the quote below 'You are using PHP 5.3. The Array Initialization Construct: [] will not work. Instead, use this approach:' is what I just researched in the internet. I am using PHP 5.6 right now.
ChooeyCraft
CC BY-SA 3.0
2017-12-12T00:00:44.453Z
What I'm saying is, I don't think you are. Go to the `/admin/utils/phpinfo` page of your site, and see what it says there. That will tell you which version Craft itself is seeing.
Lindsey D
CC BY-SA 3.0
2017-12-11T23:52:40.407Z
2017-12-12T00:01:34.720Z
2017-12-12T00:01:34.720Z
Lindsey D
<p>Honestly, if you can, I'd upgrade your hosting to use PHP 7. It's about 2x as fast as 5.x, and it's much more modern. PHP 5.3 isn't even supported anymore.</p>

CC BY-SA 3.0
2017-12-11T23:57:42.697Z
Sorry about that the quote below 'You are using PHP 5.3. The Array Initialization Construct: [] will not work. Instead, use this approach:' is what I just researched in the internet. I am using PHP 5.6
ChooeyCraft
CC BY-SA 3.0
2017-12-12T00:01:37.480Z
I updated my question so everyone will not get confused.
ChooeyCraft
CC BY-SA 3.0
2017-12-11T23:53:31.700Z
2017-12-11T23:53:31.700Z
andrew.welch
<p>I am having a syntax error on my craftCMS website. Hoping someone could help me. </p>

<blockquote>
  <p>Parse error: syntax error, unexpected '[' in /home16/puresoci/public_html/dev/craft/plugins/charge/ChargePlugin.php on line 14</p>
</blockquote>

<p>Here's the line that it is referring to</p>

<pre><code>  craft()-&gt;templates-&gt;hook('charge.prepCpTemplate', [$this, 'prepCpTemplate']);
</code></pre>

<p>Here's the whole function </p>

<pre><code>public function init()
{
    craft()-&gt;charge_license-&gt;ping();

    if (craft()-&gt;request-&gt;isCpRequest()) {
        $this-&gt;includeCpResources();
        craft()-&gt;templates-&gt;hook('charge.prepCpTemplate', [$this, 'prepCpTemplate']);
        craft()-&gt;templates-&gt;hook('charge.prepCpSettingsTemplate', [$this, 'prepCpSettingsTemplate']);
    }
}
</code></pre>

<p>But I am a beginner on using PHP and I dont know how should I update this. I am using PHP 5.6 right now.</p>

<plugins><craft-pro>
Parse error: syntax error, unexpected '['
# Parse error: syntax error, unexpected '['

(Asked by: username_0 on 2017-12-11)

I am having a syntax error on my craftCMS website. Hoping someone could help me. 

Parse error: syntax error, unexpected '[' in /home16/puresoci/public_html/dev/craft/plugins/charge/ChargePlugin.php on line 14

Here's the line that it is referring to
  craft()->templates->hook('charge.prepCpTemplate', [$this, 'prepCpTemplate']);

Here's the whole function 
public function init()
{
    craft()->charge_license->ping();

    if (craft()->request->isCpRequest()) {
        $this->includeCpResources();
        craft()->templates->hook('charge.prepCpTemplate', [$this, 'prepCpTemplate']);
        craft()->templates->hook('charge.prepCpSettingsTemplate', [$this, 'prepCpSettingsTemplate']);
    }
}

But I am a beginner on using PHP and I dont know how should I update this. I am using PHP 5.6 right now.

**Tags:** plugins, craft-pro


---

## 2 answers

### Answer by username_1 on 2017-12-11. Score: 1 | Accepted answer

The Charge plugin requires a minimum of **PHP 5.4**.

The brackets notation for arrays (which is what Charge uses) was added in 5.4.

> <http://php.net/manual/en/language.types.array.php>

Contact your hosting provider to find out how to upgrade.

> **Comments:**
> **username_0**: I am using PHP 5.6 it works fine yesterday but when I open it today I got that error.  
> **username_1**: Your post explicitly says you found a message stating "You are using PHP 5.3." I'd recommend you check again.  
> **username_0**: Sorry about that the quote below 'You are using PHP 5.3. The Array Initialization Construct: [] will not work. Instead, use this approach:' is what I just researched in the internet. I am using PHP 5.6 right now.  
> **username_1**: What I'm saying is, I don't think you are. Go to the `/admin/utils/phpinfo` page of your site, and see what it says there. That will tell you which version Craft itself is seeing.  

---

### Answer by username_2 on 2017-12-11. Score: 1

Honestly, if you can, I'd upgrade your hosting to use PHP 7. It's about 2x as fast as 5.x, and it's much more modern. PHP 5.3 isn't even supported anymore.

> **Comments:**
> **username_0**: Sorry about that the quote below 'You are using PHP 5.3. The Array Initialization Construct: [] will not work. Instead, use this approach:' is what I just researched in the internet. I am using PHP 5.6  
> **username_0**: I updated my question so everyone will not get confused.  

---

