This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 6 years ago.
$router->addRoutes('', ['controller'=>'Home', 'action'=>'index']);
during compilation its generate an error
Parse error: syntax error, unexpected '['
Please help.
If is not >=5.4
PHP versions <= 5.4 do not support the [] syntax for array construction. Instead you shoud use array():
$router->addRoutes('',array('controller'=>'Home', 'action'=>'index'));
Related
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 5 years ago.
When i try to run this script :
include('db.php');
$site=file_get_contents("https://example.com");
$baslik='#<title>(.*?)</title>#si';
$içerik='#<div class="post-content">(.*?)</div>#si';
$kategori='#<p class="post-categories"><span>Kategoriler:(.*?)</a></p>#si';
preg_match($baslik,$site,$baslikfonksiyon);
preg_match($icerik,$site,$icerikfonksiyon);
preg_match($kategori,$site,$kategorifonksiyon);
$baslikkullan=$baslikfonksiyon[1];
$icerikkullan=$icerikfonksiyon[1];
$kategorikullan=$kategorifonksiyon[1];
i see this error in error_log file :
[01-Mar-2017 20:39:41 UTC] PHP Parse error: syntax error, unexpected
'preg_match' (T_STRING) in /example/file/path on line 9
Can anyone explain to me why i get this error
Thanks.
I think you have problem with the regex. Try with:
$baslik = '^.*?<\/title>';
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 7 years ago.
namespace my;
const DHA=__NAMESPACE__."you are accessing constant"; //generate parse error
const DHA=__NAMESPACE__,"you are accessing constant"; //generate parse error
I tried concating using '.' and ',' but both it gives
Parse error: syntax error, unexpected '.', expecting ',' or ';'
EDIT (UPDATE) : This is a bug in PHP 5.5. It has been resolved in 5.6. https://wiki.php.net/rfc/const_scalar_exprs.
Which version of PHP
See https://bugs.php.net/bug.php?id=42355
Considered a new feature in 5.6
I have 5.5.9 right now and get the same results as you do
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 7 years ago.
I am using twitterauth.php for getting twitter data in codeigniter php.
It gives me error
Parse error: syntax error, unexpected '[' in C:\xampp\htdocs\twitter\application\controllers\twitteroauth.php on line 117
Line 117 is
public function oauth($path, array $parameters = [])
You need PHP 5.4 or over to use square brackets as array. Upgrade PHP or use array().
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 7 years ago.
I came across the following error, but I fail to see what is wrong:
Parse error: syntax error, unexpected ''aws_account.aws_account_id'' (T_CONSTANT_ENCAPSED_STRING) in C:\xampp\htdocs\laravel\awsconfig\app\controllers\CRUDController.php on line 11
my join statement where the error is being thrown:
$query = DB::table('ec2_instance')->join('aws_account', 'aws_account.id', '=', 'ec2_instance.id')->select('ec2_instance.instance_id', 'ec2_instance.public_dns_name', 'ec2_instance.key_name','ec2_instance.instance_type','ec2_instance.launch_time','aws_account.aws_account_id')->get();
You've got some junk characters there between the last , and ':
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
php parse/syntax error help
I keep getting a "Parse error: syntax error, unexpected ':', expecting ')' in /home/jobkill/public_html/process.php on line 8" when processing inputs from a page that redirects here. I dont know what to fix.
You cant use these backquotes, use
"
instead