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.
5
votes
3answers
100 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
0answers
17 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
0answers
67 views
PHP parse error on simple helloworld
I am new to php and am trying to work with it in the command line (via online tutorial). I have a file helloworld.php that looks like:
<?php
echo "Hello World!";
?>
I have also tried using ...
0
votes
0answers
25 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
1answer
44 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
0answers
40 views
Parse error: syntax error, unexpected T_VAR in
Please help...copied and pasted into my functions.php in a wordpress site and I keep getting the error "Parse error: syntax error, unexpected T_VAR in /nfs/c04/h03/mnt/85083/domains/stockadegroup.com/...
0
votes
1answer
16 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
1answer
44 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
1answer
36 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
1answer
39 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
vote
1answer
86 views
Parse error: syntax error, unexpected ';' (T_STRING), how can i fix this? [closed]
This is my connection page
<?php
$servername ='localhost';
$username ='root';
$password ='';
$dbname ='credit_list';
$conn = mysqli_connect($servername,$username,$password) or die(mysqli_error())...
-1
votes
3answers
100 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,...
2
votes
2answers
2k 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
0answers
27 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
2answers
87 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:
...
0
votes
2answers
122 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
3answers
109 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";
$...
-1
votes
1answer
32 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
1answer
82 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::...
-3
votes
1answer
66 views
guys could you help solved this error
foreach ($navItems as $item) {
echo "<li><a href=\"$item['slug']\">$item['title']</a></li>" ;
}
?>
Parse error: syntax error, unexpected '' (...
-1
votes
1answer
405 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['...
0
votes
1answer
273 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
1answer
447 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
4answers
1k 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
8answers
174 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
1answer
35 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
1answer
98 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. ...
-2
votes
1answer
2k 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 ...
1
vote
1answer
382 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 ...
2
votes
1answer
64 views
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:
<?...
0
votes
4answers
100 views
PHP Parse error unexpected T_VARIABLE [closed]
I keep receiving this error in the code below when I execute my file. I've looked it over and can't seem to figure out what I'm doing wrong:
Parse error: syntax error, unexpected T_VARIABLE in /home/...
-2
votes
1answer
49 views
Parse error: syntax error, unexpected '[' php
I have the following line of code which has been giving me this error:
Parse error: syntax error, unexpected '[' php
For this line:
$str = removeTags($str, ['script', 'style']);
Why am I getting ...
0
votes
1answer
57 views
Parse Error: Unexpected T_OBJECT_OPERATOR
I am receiving the following parse error on line 16: 'syntax error, unexpected T_STRING'. That being said, the following block of codes parses correctly with PHP 5.4.16, however, does not parse ...
2
votes
1answer
188 views
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:
...
-4
votes
2answers
74 views
PHP 'power of' results in parse error [duplicate]
The following code:
5 ** 2
results in this error:
PHP Parse error: syntax error, unexpected '*'
And I have no idea why. Can anyone help me?
0
votes
1answer
128 views
phpunit parse error in symfony2
Situation
I am using phpunit (4.1.10) and phpunitBundle (4.1.*) in order to unit test my symfony2 (2.4.4) application. I am using phpwamp (alias for php of wamp) version 5.4.10, php installed on ...
1
vote
0answers
94 views
Why won't my PHP parse correctly?
I know the title is vague, but the details for this particular question would make the title absurd.
I have an index.php file that has a virtual include within it:
<!--#include virtual="/includes/...
2
votes
1answer
238 views
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/...
0
votes
1answer
98 views
unexpected T_CONSTANT_ENCAPSED_STRING with quotes [closed]
Can someone help me to find what is wrong in the $secret line ?
$secret should give :
{"name":"JustAname","extra":"1","password":"ASD123","report":"http:\/\/website.com\/dev\/gamereport\/0001.php"}...
0
votes
1answer
199 views
PHP: syntax error, unexpected '[' when using array_map
I've been creating a php script for a project and have been running it on my development server which is running PHP 5.4.17
I need to move it over to my production server which is running PHP 5.4.19
...
-1
votes
2answers
116 views
Parse error: syntax error, unexpected '$Points' (T_VARIABLE) [closed]
I'm trying to make a form that updates a datebase but it gives me an error. Do you have any idea what it could be from?
The error:
Parse error: syntax error, unexpected '$Points' (T_VARIABLE) in
...
0
votes
1answer
200 views
How do I take an SMS and make a call to alert someone based on what SMS says?
So I am trying to take an incoming SMS and based on what the SMS says make a call with a specific recording.
For example:
I have a door sensor with a modem that can send a text to my twilio # when ...
0
votes
1answer
486 views
Wordpress PHP - Parse Error
I'm having trouble logging onto the Admin page of my website www.millcroftrealestate.com
It says "Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE in /home/sting692/public_html/...
-2
votes
2answers
373 views
PHP - SQL parse statement error (unexpected T_LNUMBER) [closed]
Can anyone help me debug this problem? This is part of a php script which I want to run from cron. I've been looking at it but cannot figure out what is wrong.
The following line throws the PHP error "...
1
vote
1answer
677 views
Infinite loop reading a text file
I am making a custom theme in WordPress. Now inside the theme folder is another folder named "php" with a text file in it, let's say "names.txt". Now what I want to do is read the text file from the "...
0
votes
5answers
353 views
PHP Form Confirmation Parse Error
I have some very simple PHP code that I'm using to confirm input from a form.
HTML:
<!DOCTYPE html>
<html>
<head>
<title>Unit 7 - Homework 5</title>
<...
-2
votes
1answer
776 views
Unexpected T_VARIABLE, expecting T_FUNCTION 4 [closed]
I keep getting the following error in PHP:
Parse error: syntax error, unexpected '$date' (T_VARIABLE), expecting function (T_FUNCTION) in your code on line 3
With the following code:
<?php
...
0
votes
2answers
587 views
Show a message if user is not logged in
My home page has an link to the profile page (profile.php). The profile page can only be seen by the users who are logged in. If a user clicks the profile link before log in he/she will be redirected ...
4
votes
3answers
1k views
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:
...
-2
votes
1answer
38 views
I'm making/editing a WP theme and im getting this error [closed]
<div id="custom-header">
<?php
// Header code from Twenty Ten
// Check if this is a post or page, if it has a thumb-nail, and if it's a ...