92 questions
0
votes
0
answers
20
views
PHP parse error /syntax errors; and how to solve them [duplicate]
im trying run this code but show error :
(Parse error: syntax error, unexpected ':', expecting ')' in D:\xamp\htdocs\Personal\Personal.php on line 21)
my code :
<?php
$query = ...
1
vote
1
answer
605
views
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 ...
0
votes
1
answer
683
views
I'm new to php I'm getting this error "PHP Parse error: syntax error, unexpected '$sum' (T_VARIABLE)" [duplicate]
This is the code
<?php
$sum=1+1;
$sub=1-1;
$div=1/1;
$mult=1*1;
printf("SUM:%d\nSUB:%d\nDIV:%d\nMULTI:%d\n",$sum,$sub,$div,$mult);
?>
ERROR:
PHP Parse error: syntax error, ...
0
votes
0
answers
22
views
Unexpected token ";" with PHP, I already checked for a missing paranthesis but can't find one [duplicate]
So I'm creating a PHP function which should insert data into a mySQL database. There are no mistakes outside this function, error message says it's in the first line inside the function, "$sql = &...
0
votes
0
answers
102
views
AJAX Return ParseError with plain text of php file
I am doing an ajax request to a php file to return a certain value.
I did some console logs to check the results:
readyState: 4
Status: 200
responseText: php file in plain text
error: parseError
Can ...
0
votes
1
answer
713
views
PHP code: syntax error, unexpected end of file [duplicate]
I have been stuck on my code for a while and has tried googling but cannot find whats the problem with my code, can someone help me? It returns the error "Parse error: syntax error, unexpected end of ...
0
votes
1
answer
64
views
Parse PHP current user update failed but session updated
In Parse PHP SDK If the current user want to change his Email/username normally Parse check if username used by other user and if it is used it will return error, now this is good and work perfectly ...
0
votes
1
answer
385
views
How can I solve error of unexpected } in php
When I was running a process in ProcessMaker, I got error message "Fatal error in trigger", then I checked the error logs and found this
PHP Parse error: syntax error, unexpected '}' in /opt/...
0
votes
1
answer
74
views
include function results parse error in php [duplicate]
In this following php code when I include "teacher-header.php" it encounters a error
Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\eClassroom\teacher-dashboard.php on line 100
line 100 ...
0
votes
0
answers
55
views
PHP/ Angular- why am I getting unexpected '<' in my view after surrounding the HTML with an @if statement?
I have a Laravel/ Angular application, and want to alter the contents of a PDF that's generated on one of the pages based on the content of the variables that will be displayed on that PDF.
The PDF ...
0
votes
1
answer
102
views
How can I prevent an unexpected Syntax error?
I tried to execute this command in the terminal:
php bin/console cache:clear --env=prod --no-debug
But I get the following error message:
Parse error: syntax error, unexpected '?' in /is/htdocs/...
0
votes
1
answer
281
views
Leading space before php opening tag in switch case statement
As you can see there is a leading space before opening tag in case 1: line:
$var = 1;
switch ($var):
?>
<?php case 1:?> // BUGGY LINE
<?php
echo 1;
break;
...
0
votes
2
answers
1k
views
Parse error: syntax error, unexpected ';', expecting ')' (Wordpress functions.php)
I have been creating a module for visual composer plugin, however, when I already have all the code mounted and saved in the functions.php file, I get the following error:
syntax error, unexpected ';'...
0
votes
1
answer
1k
views
Laravel error after changing php version
I just setup php 7.0.27 in both webserver and cli. My laravel project was working just fine before in php 7.2. When I try run command php artisan serve it shows an error:
PHP Parse error: syntax ...
-1
votes
1
answer
74
views
Why the parse error is being thrown upon using one array notation inside double-quoted string and and not upon using the other?
Consider below code :
<?php
$arr = array('fruit' => 'apple', 'veggie' => 'carrot');
define('fruit', 'veggie');
print "Hello {$arr['fruit']}"; //This works
print "Hello $arr['...
0
votes
1
answer
1k
views
Parse error Unexpected } in if-else block [duplicate]
I have been searching on SO for over an hour but couldn't get my issue resolved. For some reason there is error on page as Parse Error: syntax error unexpected } in line 262. It is closing brackets ...
-1
votes
1
answer
326
views
Parse error: syntax error, unexpected '['
Was trying to install a wp plugin- dt world clock and got this error msg.
The actual error msg:
Parse error: syntax error, unexpected '[' in /var/www/html/wp-content/plugins/dt-world-clock/dt-world-...
0
votes
3
answers
45k
views
Parse error: syntax error, unexpected ',', expecting variable (T_VARIABLE)
I've got error on defined-function and from error_reporting(E_ALL);
There are errors Parse error: syntax error, unexpected ',', expecting variable (T_VARIABLE) in C:\xampp\htdocs\bs4\func.php on line ...
0
votes
0
answers
1k
views
PHP Parse error: syntax error, unexpected T_STRING at NAMESPACE
Problem
I have an application that I am attempting to get online; from local dev-machine to hosting server. Albeit, my application works locally via XAMPP, running PHP v5.6, my hosting server throws ...
0
votes
1
answer
121
views
PHP Parse error when executing query [duplicate]
This should be a very basic error, but based on the error-description I can't seem to figure it out. Either I misunderstood some part of the concept or it's just some sign missing.
The problem arises ...
-3
votes
1
answer
147
views
Getting parse error in php
For some reasons I am getting parse error on the last line of the file even it is blank. I've used connect.php file as a connection file for putting the comment into the database. I'm using wampserver ...
-2
votes
1
answer
879
views
PHP Error : Parse error: syntax error, unexpected '<' in filename.php
I have three buttons , Edit remove and view .. on view part i am trying to echo the row ID in order to fetch details . But i get this parse error .
Here is the Code :
while( $row=mysqli_fetch_array(...
1
vote
1
answer
76
views
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/...
0
votes
1
answer
582
views
CodeIgniter PHP Parsing Error unexpected '{', expecting '('
What's with this PHP Parsing Error Unexpected '{', expecting '('
No backtrace, no any other error message, just one line in the controller, that's it -_-
I kept looking for solutions and reading ...
-4
votes
1
answer
38
views
Why the full wordpress site is down because of one syntax error
I was using a List category posts plugin and while editing for custom need a one file of this plugin - i have got an error (it was because of wrong usage of backslashes to escape special characters ...
9
votes
3
answers
3k
views
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:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/...
0
votes
0
answers
20
views
Parse error: syntax error, unexpected 'openFile' (T_STRING), expecting variable (T_VARIABLE) line 18 [duplicate]
I know this is a very generic error, but I am getting a:
( ! ) Parse error: syntax error, unexpected 'openFile' (T_STRING), expecting variable (T_VARIABLE) in //file on line 13
and here is my ...
0
votes
0
answers
35
views
Always get HTTP Error 500 from MAMP [duplicate]
If I try to open a php page with a any error inside, the browser always show me "HTTP ERROR 500"; so I have to look at the error log to have better informations about what's wrong with the code.
Is ...
1
vote
1
answer
182
views
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. ...
0
votes
1
answer
190
views
PHP inline condition not working in PHP 5.3.29 but working in 5.6.7 [duplicate]
This is totally bewildering for me as I've never experienced such a thing before. My localhost environment is 5.6.7 PHP and my production server (shared hosting) is currently running 5.3.29 and it ...
-1
votes
1
answer
82
views
If statement in mysql while loop doesn't work [duplicate]
i have the problem, that i want to make an algorithm which reads the dates of every record from the database and check if it's the date from an array. When it's the right date, it will parse it to ...
1
vote
1
answer
111
views
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:
<?php
echo "<class="."com.tests.".$...
0
votes
1
answer
2k
views
PHP - Error=> T_CONSTANT_ENCAPSED_STRING [duplicate]
I am generating JSON feed and getting syntax error, unexpected ''Venue'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in line 25 All names ad fields are correct in database. The code I am using is here
...
-1
votes
3
answers
607
views
PHP MySQL Query php parse error [duplicate]
I have this mysql query:
$sql = "INSERT INTO lijsten(naam, niveau, nederlands, duits, frans, grieks,
engels, latijn, spaans, wiskunde, natuurkunde, scheikunde, geschiedenis,
economie, aardrijkskunde,...
4
votes
3
answers
9k
views
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
/Applications/XAMPP/xamppfiles/htdocs/learnlaravel5/...
0
votes
0
answers
69
views
couldn't resolve parse.api.com , Error code - 6 with parse-php-sdk
couldn't resolve parse.api.com
I am unable to even login in my website which is parse-php-sdk based.I got couldn't resolve parse.api.com error with Error code - 6, do i have to change something in my ...
1
vote
2
answers
902
views
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 ...
1
vote
2
answers
1k
views
Why Error if open and close PHP tags between switch and first case statement? [duplicate]
Works:
<?php switch ($student[$use_grade]) {
case "K": ?>
<?php echo 'works'; ?>
<?php break; ?>
<?php } ?>
Doesn't work:
<?php ...
-1
votes
3
answers
4k
views
Passing and using an array by reference in PHP [closed]
In a PHP function, I'd like to append values to an array that was passed in by reference. For example:
function foo(array &$arr) {
$arr[] = "error on this line";
$arr[] = "more";
$...
-2
votes
1
answer
60
views
I have this bit of php code in my wordpress theme But all i gives me is a Parse error [duplicate]
I have this bit of php code in my wordpress theme where tags of posts are to be fetched and displayed in different colors as specified. But all i get is a Parse error.
I would be thankful if someone ...
0
votes
1
answer
114
views
PHP: variable class in a class property - why calling static method return parse error? [duplicate]
Since PHP version 5.3 we can call static method in a variable class like this:
class A
{
public static function foo()
{
echo 'bar';
}
}
$myVariableA = A::class;
$myVariableA::...
-1
votes
1
answer
5k
views
Parse error: syntax error, unexpected 'insert' [closed]
I am new to php. I am trying to connect android with phpmyadmin using webservice .
php Code
<?php
include_once('configuration.php');
$UserId = $_POST['UserId'];
$ProductId = $_POST['ProductId'...
0
votes
1
answer
623
views
Can I disable some errors that match a specific criteria on a PHP script in PhpStorm 8.0.2?
I would like to ask e.g. if I have a code like this:
/**
* Doc comment
*/
@Annotation
class MyClass {
}
I know it will generate a parse error cause PHP doesn't have annotations natively like Java (...
0
votes
1
answer
841
views
Laravel 4.2 doesn't catch the "PHP Parse errors" when they happen in Controllers or routes.php?
In Laravel 4.2 the errors are caught and displayed on a "pretty" page, thanks to Whoops. The error is also logged in the configured log file (by default : storage/log/...).
You can be a very good ...
1
vote
4
answers
4k
views
PHP 5.6.3 Parse error: syntax error, unexpected '[' in class
While I was creating a class in php, I experienced this error:
Parse error: syntax error, unexpected '[', expecting ',' or ';' on line 5
A simple example:
<?php
class MyClass
{
public $...
-1
votes
8
answers
383
views
How to detect a syntax error in PHP? [duplicate]
I have got a PHP syntax error called
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\...
0
votes
1
answer
58
views
XML parser and PHP Variables
i've created a complex script for parser datas from XML.
At the end of this, i have this:
$xmlArray['Event'][$k]['Name event']= $nameVal;
$xmlArray['Event'][$k][$i]['Type event']= $...
-2
votes
1
answer
374
views
Parse error on explode function
Parse error: syntax error, unexpected '[' on line 108
$row->liked_by = $row->liked_by ? explode('|', $row->liked_by) : [];
This is the error i am getting but works fine on the local server. ...
-1
votes
1
answer
3k
views
Parse error: syntax error, unexpected T_DNUMBER in C:\Inetpub\vhosts\ [closed]
I have this error message on windows vps.
Complete error message:
"Parse error: syntax error, unexpected T_DNUMBER in C:\Inetpub\vhosts\kayahomesonline.com\httpdocs\configuration.php on line 24"
My ...
0
votes
1
answer
715
views
Parse error: parse error, unexpected T_DOUBLE_ARROW, expecting '(' [closed]
I get this error when I'm trying to do this:
$connBD = new PDO("mysql:host=$dbHote;dbname=$dbNom", $dbUtilisateur, $dbMotPasse, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
// Pour ...