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];
?>
Related
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.
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 5 years ago.
echo '<b><h2>Bu Fiyat İçin Oyun Sistemi Önermiyoruz. Bütçenize Yakın Bir Fiyatla 1800TL'lik Sistemimizi Tercih Ediniz.</h2></b><br><br>Tıklayınız.<br><br> Şimdiden Hayırlı Olması Dileğiyle, İyi Günler.';
I'm giving that error. Please help me.
I guess you need to escape the '...
Try this:
<?php
echo '<b><h2>Bu Fiyat İçin Oyun Sistemi Önermiyoruz. Bütçenize Yakın Bir Fiyatla 1800TL\'lik Sistemimizi Tercih Ediniz.</h2></b><br><br>Tıklayınız.<br><br> Şimdiden Hayırlı Olması Dileğiyle, İyi Günler.';
?>
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") ?>
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';
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 7 years ago.
Basically I am trying to check if a variable is equal to 5, and then echo something if it is, but I get this error.
PHP Code
if ($adminlevel) === '5' {
echo 'user is owner';
}
Error
Parse error: syntax error, unexpected '===' (T_IS_IDENTICAL) in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\projects\Portfolio -- Website\forum\index.php on line 12
if ($adminlevel === '5') {
echo 'user is owner';
}
Move the paren to include the entire statement.