title: How to use str_repeat to repeat a string from an array giving an index of each loop of the str_repeat
body: <p>I'm trying to concatenate array keys (which are originally a class properties). So what I did is:</p>
  
  <pre><code>echo '&lt;pre&gt;'.print_r(array_keys(get_object_vars($addressPark)),TRUE).'&lt;/pre&gt;';
  </code></pre>
  
  <p>Outputs:</p>
  
  <pre><code>Array
  (
      [0] =&gt; streetAddress_1
      [1] =&gt; street_address_2
      [2] =&gt; city_name
      [3] =&gt; subdivision_name
      [4] =&gt; country_name
  )
  </code></pre>
  
  <p>This is how I get the <code>AddressPark</code> object's properties names.</p>
  
  <pre><code>$arr = array_keys(get_object_vars($addressPark));
  $count = count($arr);
  </code></pre>
  
  <p>I want to access the object properties by index, that is why I used array_keys.</p>
  
  <pre><code>$props = str_repeat("{$arr[$count-$count]},",$count-2).$arr[$count-1];
  echo $props;
  </code></pre>
  
  <p>The results is: </p>
  
  <blockquote>
    <p>streetAddress_1,streetAddress_1,streetAddress_1,country_name</p>
  </blockquote>
  
  <p>It repeats <code>$arr[0] = 'streetAddress_1'</code> which is normal because in every loop of the <code>str_repeat</code> the index of <code>$arr</code> is <code>$count-$count = 0</code>.
  So what I exactly want <code>str_repeat</code> to do is for each loop it goes like: <code>$count-($count-0),$count-($count-1)</code> ... <code>$count-($count-4)</code>. Without using any other loop to increment the value from (0 to 4).</p>
  
  <p>So is there another way to do it?</p>