Questions tagged [php-parse-error]

A PHP 'Parse error' signifies that the syntax of the PHP script is somehow incorrect. Generally, this is due to simply overlooking an element of syntax: a missing semicolon, bracket, brace or quote.

A PHP 'Parse error' signifies that the syntax of the PHP script is somehow incorrect. Generally, this is due to simply overlooking an element of syntax: a missing semicolon, bracket, brace or quote.

Before using this tag, please ensure your answer is not found in the many answers to PHP Parse/Syntax Errors; and How to solve them?

94 questions
118
votes
3 answers

Can a class extend both a class and implement an Interface

Can a class extend both an interface and another class in PHP? Basically I want to do this: interface databaseInterface{ public function query($q); public function escape($s); //more methods } class database{ //extends both mysqli and…
Pim Jager
  • 31,965
  • 17
  • 72
  • 98
8
votes
3 answers

PHP throwing error on XML opening tag

I have a file that is including a file named sitemap.html and in the sitemap, I have the following code:
Chin Leung
  • 14,621
  • 3
  • 34
  • 58
6
votes
3 answers

Error code while trying to use private variables in a function

I get an error that says Parse error: syntax error, unexpected T_PRIVATE in E:\PortableApps\xampp\htdocs\SN\AC\ACclass.php on line 6 while trying to run my script. I'm new to classes in PHP and was wondering if someone could point out my…
JoeCortopassi
  • 5,083
  • 7
  • 37
  • 65
4
votes
3 answers

Cannot use 'PhpParser\Node\Scalar\String' as class name as it is reserved

When I use the composer to install Laravel 5 I get this error: Cannot use 'PhpParser\Node\Scalar\String' as class name as it is reserved in …
葛文瑞
  • 43
  • 1
  • 3
4
votes
3 answers

Why is PHP throwing this parse error?

I have a small question for you all. I currently have my site on 000webhost, and the following line: $price = explode(".",$item->sellingStatus->currentPrice)[0]; causes the following error: Parse error: syntax error, unexpected '[' in …
Nickersoft
  • 684
  • 1
  • 12
  • 30
3
votes
3 answers

Make PHP database class generic by Generating dynamic variables

Please look at the code, the array contains the table field names of the table class User { public $db_fields = array('id', 'username', 'password', 'first_name', 'last_name'); public $id; public $username; public $password; …
Ahmad Ismail
  • 11,636
  • 6
  • 52
  • 87
2
votes
1 answer

weird mistake on my php server

I have some trouble in my php server, I have a page that is includes using the function include this page is called validation.phtml then in that page I call a function that I did like that: when I go on…
Stanislas Piotrowski
  • 2,595
  • 10
  • 40
  • 59
2
votes
1 answer

PHP Parse error using DIRECTORY_SEPARATOR in class variable

Why can I assign $tmpPath = DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR; within a class method but get an PHP Parse error when I trie to assign it to a protected class variable like this: protected $_tmpPath = DIRECTORY_SEPARATOR . 'tmp' .…
magic_al
  • 1,930
  • 1
  • 18
  • 26
2
votes
1 answer

Parse error: unexpected '@' symbol in constant function in php

In my project, when I try to install a software, I got an parse error in last step of installation The parse error is Parse error: syntax error, unexpected '@' in /path/to/server/subfolder1/projectfoldername/subfolder/filename.php on line…
Rithu
  • 1,289
  • 3
  • 19
  • 38
2
votes
2 answers

PHP - Parse error: syntax error, unexpected ')'

recently I have gotten this error: Parse error: syntax error, unexpected ')' in /home/aps/public_html/wp-content/themes/Valor/functions.php on line 54 I have looked at this line and found no problems, and ran it through a PHP error code finder. Just…
Zak Parker
  • 21
  • 1
  • 2
1
vote
1 answer

Null Coalescing Assignment Operator throwing parse / syntax error in PHP 8.0

I'm transitioning from 7.3 to PHP 8.0 (centOS) and going through the fun process of patching hordes of undefined array keys. It's easy, but time consuming. One new tool offered by PHP I hoped would offset this burden is the new Null Coalescing…
jtubre
  • 669
  • 1
  • 8
  • 13
1
vote
1 answer

PHP parse error with no explanation

PHP is giving me a parse error here. if ($detalleReserva->isGratis() || $detalleReserva->isPasajeroSinCosto()){ $cantPaxGratis++; } Parse error: parse error in /Library/WebServer/Documents/versioned/software/tur/liquidacionHead.php on line…
user1532587
  • 993
  • 1
  • 14
  • 39
1
vote
1 answer

Parse error in php web driver

I have no idea about PHP programming before. Now I am working on selenium using Facebook php web driver. I have just started with very basic test code that is to open pages and click links and so on. But I got stuck just after few lines of code and…
1
vote
1 answer

Limit echo of variable in PHP to get the desired characters

$response var has a component called custom_test_name which looks like below: [Test_Name]ad.no.check1.check2.check3 and here is the small PHP code: "; ?> This prints…
Pratik Jaiswal
  • 309
  • 7
  • 26
1
vote
2 answers

Parse error php Codeigniter

I have this function on my code, and give me this error: syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ')' on line 25 I cant find the error maybe you can see what I can't D: public function InsertHero() { …
Ali ATriple
  • 179
  • 15
1
2 3 4 5 6 7