title: I want to return the value of a PHP Array with automatic loop index and into a string
body: <p>I have array $Computer with value:</p>
  
  <pre><code>array(1) {
      [0]=&gt; array(4) {
              [0]=&gt; string(1) "0"
              [1]=&gt; string(10) "Produksi01"
              [2]=&gt; string(12) "172.16.44.25"
              [3]=&gt; string(28) "Wednesday, 13 May 2020 01:07" 
      } 
  }
  </code></pre>
  
  <p>I want return the value of the array without having to write the index is one-on-one like this <em>$computer[0][1]</em>, i want it like automatic only with one line code for all output,</p>
  
  <p>I've tried this line of code but it not working, output error undifined offset</p>
  
  <pre><code>foreach( $computer as $row ){
      for($i=0; $i&lt;=count($computer[0]); $i++){   
          $result = "$row[$i]";
      }
  }
  </code></pre>
  
  <p>my expect the $result variable that contains an array can be assigned to be part of the query.</p>
  
  <pre><code>query = "INSERT INTO mytable VALUES ($result)";
  </code></pre>
  
  <p>my expectation output is a variable result become like this : </p>
  
  <pre><code>"INSERT INTO mytable VALUES ('0','Produksi01','172.16.44.25','Wednesday, 13 May 2020 01:07')"
  </code></pre>
  
  <p>and can be executed into the database</p>
  
  <pre><code>$db-&gt;query($query)
  </code></pre>
  
  <p>I want create a class where there is a very reusable createData function that can be used by simply replacing the value of array/value input</p>