Skip to content

syntax error, unexpected '}' for end of the #php #vscode #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mbekir705-pnc opened this issue Sep 18, 2020 · 4 comments
Open

syntax error, unexpected '}' for end of the #php #vscode #2

mbekir705-pnc opened this issue Sep 18, 2020 · 4 comments

Comments

@mbekir705-pnc
Copy link

when I try to submit code below, I get an error just like on the title. someone says "it can be a misclosing something". on very old versions ıt should be added "endif" for closing tag but it did not work, tho.
Mac OS catalina 10.15.16 and vscode is the latest version I guess.
problematic line is <?php}?> and the } is pointed by editor. Any suggestion is welcome. And I hope I am clear, enough. (fist time in github)
`<?php

$products =[
['name' => 'shiny', 'price' =>20],
['name' => 'green', 'price' =>10],
['name' => 'red', 'price' =>15],
['name' => 'gold', 'price' =>5],
['name' => 'light', 'price' =>40],
['name' => 'banana', 'price' =>2],
];

foreach($products as $products){
if($products['price'] <15){
echo $products['name'] . '
';
}
};
?>

<title>Document</title>
  • //
`
@mbekir705-pnc
Copy link
Author

            <?php if($products['price'] <15){?>
                <li><?php echo $products['name']  ?></li>
            <?php}?>
        <?php}?>

@mbekir705-pnc
Copy link
Author

        <?php if($products['price'] <15){?>
            <li><?php echo $products['name']  ?></li>
        <?php}?>
    <?php}?>

this is the problematic part.

@mbekir705-pnc
Copy link
Author

SOLVED I just put spaces between php, }, ? in the code

@Joseph42A
Copy link

Great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants