PHP Parse error: syntax error, unexpected '?' [duplicate] - php

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 5 years ago.
I have read a lot syntax error but seldom on the error of '?'
I also saw a few post that stated this might be due to old PHP version.
So my question is does PHP5.6 isn't enough? I am using Godaddy as my host and PHP5.6 is the highest they provide.
The full error description is:
PHP Parse error: syntax error, unexpected '?' in G:\PleskVhosts\tohokiwatch.com\httpdocs\cart\vendor\illuminate\database\Eloquent\Model.php on line 579
MyPHP page stated version 5.5.30:
But my GoDaddy page stated version 5.6.30

The null coalesce operator, ?? does not exist in php 5.5 or 5.6, it was added in php 7.0

Related

Google analytics api showing Parse error: syntax error, unexpected '=' in /home2/.../.../vendor/laravel/framework/src/Illuminate/Support/Arr.php [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 4 years ago.
I am working on a google analytics dashboard which will display marketing campaign results for the customers. I am using google analytics api but I keep getting this error ( Parse error: syntax error, unexpected '=' in /home2/.../.../vendor/laravel/framework/src/Illuminate/Support/Arr.php on line 388). I searched about the error and found that it is because of a mismatch of the php version between apache server and CLI.my CLI php version used to be 7.1.12 and my apache version was 7.1.14. I upgraded it to 7.1.14 but I am still facing the same error.
This is the offending line from Arr.php:
[$value, $key] = static::explodePluckParameters($value, $key);
It seems your PHP server is still running version < 7.1.0 and it doesnt support this array notation
To test it, you can use following code (php 5.x and php < 7.1.0 throws parse error):
[$value, $key] = explode("|",'some|thing');
var_dump($value,$key);

Parse error: syntax error, unexpected 'function' (T_FUNCTION) in /home/u610435277/public_html/wp-content/themes/zerif-lite/inc/jetpack.php on line 1 [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 5 years ago.
I designed one website using Wordpress on localhost and I uploaded it to online server using filezilla, everything went success but after upload, i am facing problem, error code is give below....
Parse error: syntax error, unexpected 'function' (T_FUNCTION) in /home/u610435277/public_html/wp-content/themes/zerif-lite/inc/jetpack.php on line 1
php error
I cross checked my php code several times, it is correct. my code
Please give me sufficient information
May be you did not give a <?php at your file starting. That is why id did not expect function to begin there. Check it if this might be the problem.

syntax error in php 5.3 for namespace [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 6 years ago.
How i can fix this syntax error in php 5.3.28 ?
PHP Parse error: syntax error, unexpected '.', expecting ',' or ';'
in /home/......
protected $callback = DOMAIN.FOL_DIR.'/index/payment_back' ;
It work true at php 7 .
thanks
PHP 5.3 doesn't support constant scalar expressions. You need PHP 5.6 or newer for that.
You have to use at lease PHP 5.6 to execute scalar expression. So please upgrade your PHP version and try.
Thanks...

Laravel 5.3 is giving an error on production server while working fine on localhost [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 6 years ago.
Laravel 5.3 is giving an error on production server while working fine on localhost. Other than changing php version, is there any other possible solution?
Parse error: syntax error, unexpected '.', expecting '&' or variable
(T_VARIABLE) in
/var/www/html/laravel_fresh/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php
on line 475
No, there is not. You need to have at least PHP >= 5.6.4 in order to run Laravel 5.3.

Unexpected '[' - no error on localhost but there is one on server [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 7 years ago.
$query_var[] = '`'.array_keys($activeFilters)[$i].'` LIKE concat(\'%\',:'.array_keys($activeFilters)[$i].',\'%\')';
Parse error: syntax error, unexpected '['
So the following line generates an error in my Xampp apache server on localhost the error isn't occurring. Also on my server there was an error also with
$query_var = [];
but I changed it to $query_var = array(); and the error wanst appearing it was also a unexpected [
I am nearly sure it has something to do with the PHP version or something like that
correct, its a php version issue as of php 5.4 you can use
$query_var = [];
http://php.net/manual/en/migration54.new-features.php
so your host is running an older php version.

Categories