title: PHP add attribute to objects in foreach loop
body: <p>So my problem is - I've div with this kind of structure:</p>
  
  <pre><code>&lt;div&gt;
  &lt;strong&gt; Value 1&lt;/strong&gt;
  &lt;strong&gt; Value 2&lt;/strong&gt;
  &lt;strong&gt; Value 3&lt;/strong&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>It's a wordpress site, I've posts with slugs like - /value-1/ /value-2/ etc.
  I need to use this wp function - wp_some_function(get_ID_by_slug('any-page')); and add attribute to each of those strong tags with that post id. So it would look like:</p>
  
  <pre><code>&lt;div&gt;
  &lt;strong id="2334"&gt; Value 1&lt;/strong&gt;
  &lt;strong id="34322"&gt; Value 2&lt;/strong&gt;
  &lt;strong id="2323"&gt; Value 3&lt;/strong&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>So basically I need to get content of each , replace spaces with dash, and add it in function I wrote above to get page ID, which I need to add as "id" attribute".</p>