Parse error: syntax error, unexpected '<' PHP [duplicate] - php

This question already has answers here:
Reference - What does this error mean in PHP?
(38 answers)
Closed 7 years ago.
I have this code:
<p class="test">
<?php
$button_value = get_field('button_name');
echo $button_value;
if ($button_value == 1) {
get quote
}
?>
</p>
This is the error:
Parse error: syntax error, unexpected '<' in /home/dgsite81/public_html/dgprint/wp-content/themes/dgprint/index.php on line 122

echo 'get quote';

Related

( ! ) Parse error: syntax error, unexpected '{' in D:\Yatharth Files\wamp\www\index.php on line 121 [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 2 years ago.
Why does this code throw an error?
<?php
if(isset($_POST['aca'])){
header("location:Academic");
}elseif(isset($_POST['ed'])){
header("location:EnjoyDev");
}elseif(isset($_POST['hb'])){
header("location:Hoverboard");
}elseif(isset($_POST['lc'])){
header("location:LiveChat");
}elseif(isset($_POST['mp']){
header("location:myPro");
}elseif(isset($_POST['ym'])){
header("location:YatMath");
}
?>
LINE 121: }elseif(isset($_POST['mp']){
I didn't miss any semicolons.
LINE 121:
}elseif(isset($_POST['mp']){
should be
} elseif( isset($_POST['mp']) ) {
Also, I would suggest that you make use of spaces to improve your codes' readability. You wouldn't have made this mistake then.

Code Igniter REST_Controller.php get parse error [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 4 years ago.
I use codeigniter-restserver but i got error like
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in xxxxxxxxxxxxx\application\libraries\REST_Controller.php on line 835
here the line
if (method_exists(Format::class, 'to_' . $this->response->format))
{
// Set the format header
$this->output->set_content_type($this->_supported_formats[$this->response->format], strtolower($this->config->item('charset')));
$output = Format::factory($data)->{'to_' . $this->response->format}();
// An array must be parsed as a string, so as not to cause an array to string error
// Json is the most appropriate form for such a data type
if ($this->response->format === 'array')
{
$output = Format::factory($output)->{'to_json'}();
}
}
else
{
// If an array or object, then parse as a json, so as to be a 'string'
if (is_array($data) || is_object($data))
{
$data = Format::factory($data)->{'to_json'}();
}
// Format is not supported, so output the raw data as a string
$output = $data;
}
Update your PHP to the leatest version.

multidimensional arrays in php with parse error [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 6 years ago.
<?php
array $food= array('healthy'=>
array('Salad','Vege',Pasta'),
'unhealthy'=>
array('pizza','icecream'));
echo $food['unhealthy'][1];
?>
i am writing this code but getting this error on browser:
error : Parse error: syntax error, unexpected '$food' (T_VARIABLE),
expecting '(' in C:\xampp\htdocs\foreach.php on line 2
Remove array at the starting and also there is missing single quote before Pasta.
Try this
<?php
$food = array(
'healthy'=> array('Salad', 'Vege', 'Pasta'),
'unhealthy'=> array('pizza', 'icecream')
);
echo $food['unhealthy'][1];
?>

Parse error: unexpected end of the file, can't find it [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 7 years ago.
i'm trying to fix a error, i maked a little search and they send that was something because { or } not closed propely, but i can't find it.
The code is this one:
Parse error: syntax error, unexpected end of file in /movies.php on line 176
the code https://gist.github.com/anonymous/258531c7a81517c47de5
Line 167, close your else statement
<?php $active = get_option('widget_single'); if ($active == "true") { dynamic_sidebar( 'Single Movie' ); } else { ?>
<?php $activar_ads = get_option('activar-anuncio-300-250'); } if ($activar_ads == "true") ?>

Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) on line 10 [duplicate]

This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 7 years ago.
So i get the error
"Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in
/Applications/MAMP/htdocs/classes/class.ManageUsers.php on line 10",
does anyone know what part of the syntax is wrong? Below is the relevant class.
5 class ManageUsers {
6 public $link;
7
8 function __construct(){
9 $db_connection = new dbConnection();
10 $this->link = db_connection->connect();
11 return $this->link;
12 }
db_connection->connect(); should be $db_connection->connect(); notice the missing $

Categories