This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
I'm getting a "syntax error, unexpected T_VARIABLE" error. I don't see what I'm doing wrong?
(4 answers)
Closed 3 years ago.
Dears,
How to concatenate a variable into array value? I Tried this way, but not works:
class Teste {
public $test=1;
public $rules2 = array('asdasd'.$test);
}
Error: Constant expression contains invalid operations
Can you help me?
Thanks!!
Related
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
instantiate a class from a variable in PHP?
(5 answers)
dynamic class names in php
(7 answers)
Closed 2 years ago.
I am trying to make a small script that will load php files and then initiate classes automatically. I am trying to do it like this,
$className = ucfirst($folderName).'()';
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\$className );
//HERE I AM GETTING ERROR BECAUSE OF THE $class VARIABLE USED.
The error I get:
Parse error: syntax error, unexpected '$className' (T_VARIABLE), expecting identifier (T_STRING)
How can I get ride of the error and initiate the class?
This question already has answers here:
Access array returned by a function in php
(5 answers)
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 3 years ago.
When I run this, it works: $content = get_content(); echo $content['content']; but when I run this echo get_content()['content']; I get Parse error: syntax error, unexpected '[', expecting ',' or ';'
Is there a way around this? I can provide the actual get_content() function if that is necessary but thought I'd start here.
Thanks!
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 4 years ago.
I'm trying to echo a link to the bio of a certain person by clicking on his name and the quotations are getting really confusing...
echo("http://localhost/grav1ty/bio.php?bio=".$_SESSION['username'].'>$_SESSION['username']");
gives me an error message:
"Parse error: syntax error, unexpected 'username' (T_STRING) in C:\UwAmp\www\grav1ty\mailbox.php on line 34"
Any suggestions?!
Thanks,
for string value use quote
INSERT INTO posts (posterid, posterusername, path)
VALUES (1, 'grud', 'uploads/5bb081a7dbb660.55196915.png')
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 5 years ago.
I'm getting syntax error, unexpected '{' in the following line:
} elseif (!preg_match('/^[a-zA-Z ]*$/',$msz['letters']) {
What am I missing here?
You're missing a closing ) after $msz['letters'].
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 6 years ago.
I'm quite new to PHP. I have created an array which I have included however when I need to echo a url which is in my settings array it just gives me the following error:
Parse error: syntax error, unexpected 'templateurl' (T_STRING) in C:\xampp\htdocs\index.php on line 15
Thanks for your help and time in advance.
Try this:
<?php include('hi.php'); echo $settings['templateurl'];?>
You need to include the file first and then you are able to retrieve the data from it.