PHP: if { } parse error [duplicate] - php

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 6 years ago.
I'm using this to determine if a variable is set. I am not a beginner and normally, this works (it's not complicated either)...
if(isset($ok)) { 
[stuff happening]
}
This is the return:
Parse error: syntax error, unexpected '}' in firstlaunch.php on line 6
The thing is, that's that. My file is empty but for those few lines. I'm used to fixing those types of problems but I can't see why the error is coming since that's the only PHP on my page.
Ideas?
Thanks a lot!
++++++
Edit: the full script is:
<?php
$ok = isset($_GET['flag']);
if(isset($ok)) { 
}
?>

Ok guys, thanks a lot for the HEX editor suggestion, it worked: I had this thing between my { }:
 
Wonder where that came from... But now my file executes!
Thanks!

Related

vqcache/vq2-catalog_controller_common_header.php [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 5 years ago.
I am receiving this error message:
[17-Mar-2017 10:22:14 America/Detroit] PHP Parse error: syntax error, unexpected end of file in /home/smarthea/public_html/ocart/vqmod/vqcache/vq2-catalog_controller_common_header.php on line 50
Here is the end of my code in the vqcache PHP file:
$this->template = 'default/template/common/header.tpl'; }
{ $this->render(); }
?>
Which syntax am I missing?
See you modification-file. You just missed line number. Just look into instructions in modificator and correct it.
This error usually appear when you're using several vQmod mofificators that used same file. In you case they modify /catalog/controller/common/header.php

Echo Inside of a PHP Include [duplicate]

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.

php Parse error: syntax error, unexpected [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 7 years ago.
i get the error on the line 2, below
don't know why ... seems fine to me ... i've tried numerous ways of doing it, but the same error comes up
any ideas ?
Any help would be much appreciated ...
Basically i have an input box with a submit button and whats submitted into the box is then printed on the same page, right under the submit box.
The code is fine when i remove the html tags. don't understand why, but it happens ...
echo "<h2>Input:</h2>";
echo . "<div class='blank'>".$convert."</div>" ;
Remove the . before the start of your string. That will fix it.
echo "<h2>Input:</h2>";
echo "<div class='blank'>".$convert."</div>";

issue with php basic [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 7 years ago.
Parse error: syntax error, unexpected '<' in N:\ftp\compc\ac12mm\Practical 3 Files\myContacts.php on line 102
Any Idea what would be wrong with this please?
Please help this is really fustrating me, Im not very good at php
You cannot include HTML Code directly in your PHP code.
To fix, you must use a command like echo, print(), or break from your PHP Code. This would require a PHP end block:
} else {
?>
<TD>
Or:
} else {
echo "<TD>";
See more: http://php.net/manual/en/tutorial.firstpage.php

PHP echo and print Parse Error [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 7 years ago.
MY code is quite simple.
<?php
echo "hello world";
?>
and i get this message
Parse error: syntax error, unexpected 'world' (T_STRING) in /usr/local/zend/apache2/htdocs/index2.php on line 2
I just copied the code from above on this page because it has the straight bar quotes instead of the curly quotes. I pasted this back into text editor... and wala! it work! thanks guys for the help!!! whoever said the idea about the quotes, i am one upping you or however this site works.

Categories