PHP Questions Home

Categories

Arrays
Files
Forms
Functions
Images
MySQL
Numbers
Others
Strings
Website


PHP Functions

PHP Functions


More PHP

Top Questions
Ask a Question

How do I check if a variable is of array type?


If you want to check that you are dealing with an array and not a string, then you simply use is_array, like so:

<?php
$array 
= (1,2,3);
if(
is_array($array)) { echo "Look, an array"; } else { echo "You might be stringing me along"; }
//Look, an array
?>



More arrays PHP Questions

How can I display values in a two dimensional array?
How do I find out if a value is already in an array?
How do I add to the end of an array and know how large the array is?
How do I sort alphanumeric array data correctly?
How can I mix up the order of values in an array?