Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8535509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:26:54+00:00 2026-06-11T10:26:54+00:00

I am having this loop foreach ($unserialized as $key => $value) { $foo =

  • 0

I am having this loop

foreach ($unserialized as $key => $value) {
 $foo = <<<EOT
<div class='krudItem' id='xxx'><form class='aj' name='itemForm' method='post'
 action=''><section><label>Slider Title</label><input type='hidden'
 name='sliderKey' value=$key/><input type='text' name='sliderTitle' value='$value 
 ['slidertitle']'/></section><section> <label>Slider Location</label>
 <input type='text' 
 name=$value['sliderlocation']value='ipsum'/></section><section><label>Slider 
 Description</label><textarea name='sliderDescription'>$value
 ['sliderdescription']</textarea></section><button name='saveNew' class='saveNew' 
 value='save'>save</button><button name='newCancel' value='cancel' 
 class='deleteNew'>cancel</button></form></div>
EOT;
echo $foo;

but everytime i run it,i get

Parse error: syntax error, unexpected ” (T_ENCAPSED_AND_WHITESPACE),

I have been reading what php says about https://www.php.net/tokens and i have tried every other possible solution but the error persists.There are some white spaces but i am not sure how i would deal with them well.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:26:55+00:00Added an answer on June 11, 2026 at 10:26 am

    You need to enclose your variables in curly braces:

    $str = <<<EOF
    some string with {$some['variables']} in it
    EOF;
    

    You can put any PHP expression in {...} as long as it starts with a $.

    See the documentation on this syntax at php.net.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a foreach loop in my web application. I need to use this
I am having this For each loop foreach (Account acct in acctTest) { if
Having this (simplified) XML: <?xml version=1.0 encoding=UTF-8?> <kml> <Document> <Placemark> <name>Poly 1</name> <Polygon> <coordinates>
Having this div: <div id=advSearchDialog style=visibility:hidden;> <xx:search ID=searchUC runat=server /> </div> And a button:
Having this php code: $data['items'] = array('cars', 'bikes', 'trains'); $data['title'] = $parameters['title']; foreach ($searchResults
I am having a problem with formatting the output from foreach loop. What should
I'm having trouble getting this loop to return all of the rows that I
Been having issues trying to convert a foreach loop to linq: IList<DateTime> dicommentdates =
I have this loop // go through each alumni foreach (esDL.Alumni currAlumni in allAlumnis)
Having this errors when trying to compile/run my app using Maven. I've succeeded to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.