This seems like a really obvious question, but I'm tired of struggling for the answer.
I have an IF statement that I want to trigger ONLY if the variable I provide is a single value (Number or String). I DON'T want it running if the variable is an Array. What statement should I use to check if it's an array, and won't error out if it's not?
Variable is a String or an Array
Moderator: General Moderators
-
cpetercarter
- Forum Contributor
- Posts: 474
- Joined: Sat Jul 25, 2009 2:00 am
Re: Variable is a String or an Array
The functions which test the type of a variable are is_array(), is_int(), is_float(), is_string(), is_object(). Between them I think you can achieve what you want!
Last edited by cpetercarter on Wed Aug 11, 2010 1:27 am, edited 1 time in total.
Re: Variable is a String or an Array
Perfect. Thanks!