Concat Constant in php [duplicate] - php

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

Related

I can't get what's worng in this code it made website down [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 1 year ago.
I'm getting error in the PHP code it's a Wordpress custom theme, it made my website down.
PHP Syntax Check:
Parse error: syntax error, unexpected '$', expecting variable (T_VARIABLE) in your code on line 1
Here is the code:
$path = "/home/u921722263/domains/fallcomlegal.co/public_html/wp-content/!function($){$.easing.jswing=$.easing.swing,$.extend($.easing,{def:"easeOutQuad",swing:function(x,t,b,c,d){return $.easing[$.easing.def](x,t,b,c,d)},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b},easeOutQuad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b},easeInOutQuad:function(x,t,b,c,d){return(t/94256)}";
There is a Syntax errorin this part:
{return $.easing$.easing.def},
because $.easing is followed with a $ there should be a , or something else.
Try fixing this part.

Unexpected hyphen in namespace [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 4 years ago.
Error coming up saying
Parse error: syntax error, unexpected '-', expecting ',' or ';
alluding to
use Firebase\php-jwt\src\ExpiredException;
i pulled the file from git so not sure if it would be wise to rename the files
That is the location of the file, not the namespace.
Try this instead:
use Firebase\JWT\ExpiredException;

PHP : Parse error, syntax error [duplicate]

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'));

Parse error: syntax error, unexpected '[' in C:\xampp\htdocs\twitter\application\controllers\twitteroauth.php on line 117 [duplicate]

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().

VatNumber Validation using SOAP client [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 7 years ago.
I'm having a problem in my script class, is giving me the error:
Parse error: syntax error, unexpected '$client' (T_VARIABLE), expecting identifier (T_STRING)
But I can't figure out what is the problem with the "client Variable".
While accessing constant class members you need to use self::, but while
accessing local variable you can use simply by variable name.
So you need to use self::client instead of $client. Because $client is constant class member.
DEMO or See More Info

Categories