Can Array contain only a single key value pair?
<p>I have declared a method where it will dynamically create a database query string depending on the table my code is something like this.</p>

<pre><code>public function checkBeforeDelete($table = array(), $key , $value )
    {
        $tableCount = count($table);
        $queryString = array();
        for($i=0;$i&lt;$tableCount;$i++)
        {
            $queryString[] = "(SELECT COUNT(*) FROM $table[$i] WHERE $key = $value)+";
        }
        /***********************************************************
        Convert the array to a string using implode()              
        Remove all commas(,) using str_replace()                   
        Remove the last character of string using substr_replace()
        ***********************************************************/
        $queryString = substr_replace(str_replace(',','',implode(',',$queryString)),'',-2);
        $queryString = 'SELECT ( '. $queryString . ' ) AS sum';
        $sth = $this-&gt;dbh-&gt;prepare($queryString);
        $sth-&gt;execute();
        return $sth-&gt;fetchColumn() &gt;= 1;
    }
</code></pre>

<p>there are chances when $table array() will have only one single value for example </p>

<pre><code>$table = array('states');
</code></pre>

<p>does it still count to be an array. is it alright if an array contains only a single key value pair?</p>
