PHP: variable type

The function receives a variable, which can be of two types – an array and the result of fetching data from the database (mysql_query function)

It is required to determine the type of the variable (in order to convert it into an associative array if it is data and a database)

How to do it?


Answer 1, authority 100%

if(is_array($var)){
  //do something with array;
}else{
  while($row = mysql_fetch_array($var,MYSQL_ASSOC)){
    //do something with mysql_array
  }
}