Question

$raw_query = "('{$this->input->post('phone')[0]}')";

Heroku is giving me error on this line. It says "syntax error, unexpected [, expecting }". This weird cause xampp is not giving me this error. Is it actually an error or is there something wrong with Heroku?

Was it helpful?

Solution

I had same problem, please do following

$tmp = $this->input->post('phone');
$raw_query = "('{'.$tmp[0].'}')";
unset($tmp);

It is caused of PHP version. (as far as I remember)

OTHER TIPS

The reason is php version difference. Your xampp running php 5.4.x and heroku running might be 5.3.x.

Function array dereferencing has been added in 5.4 e.g. foo()[0].

Reffrence: http://php.net/manual/en/migration54.new-features.php

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top