title: Keep Getting an "Array to string conversion" Error when trying to run concatenation method
body: <p>So I'm working on a problem where I need to convert an array of values into a string so that it can be displayed for an excel document. But I keep on getting an "Array to string conversion" error when I try to run the export. The code is</p>
  
  <pre><code>$counties = "";
  if(isset($forms-&gt;form_info['county'])){
    for($i = 0; $i &lt; count($forms-&gt;form_info['county']); $i++){
      if(is_int($i / 10) &amp;&amp; $i != 0){
        $counties .= $forms-&gt;form_info['county'][$i] . ",\n";
      } elseif($i == (count($forms-&gt;form_info['county']) - 1)) {
        // Keep getting the error on the line below
        $counties .= $forms-&gt;form_info['county'][$i] . " ";
      } else {
        $counties .= $forms-&gt;form_info['county'][$i] . ", ";
      }
    }
  }
  </code></pre>
  
  <p>I've done a dd of a gettype on counties as well as the form element I'm trying to use, and both appeared as strings, so I'm lost on where the supposed array that's being converted is. I've tried making $form->form_info['county'][$i] into its own variable and concatenating it to the counties variable but received the same issue.</p>
  
  <p>The result of dd($forms->form_info['county'][$i]); is</p>
  
  <pre><code>"Bernalillo County"
  </code></pre>
  
  <p>The result of dd($forms->form_info['county']); is</p>
  
  <pre><code>array:1 [▼
     0 =&gt; "Bernalillo County"
  ]
  </code></pre>
  
  <p>The result of a dd(var_dump($forms->form_info['county'][$i])); is</p>
  
  <pre><code>string(17) "Bernalillo County"
  null
  </code></pre>
  
  <p>And here is the direct screenshot of the issue</p>
  
  <p><a href="https://i.stack.imgur.com/TM9Vh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TM9Vh.png" alt="Php error screen"></a></p>