php is variable an array or object

arrays, object, php, string

Solution

Use `is_array` to check if a variable is an array, and similarly, use `is_object` to check if a variable is an object.

Problem

Trying to figure out how to do the equivalent of something I did in javascript but in php. But I'm not sure of the operators to do it. In javascript I wanted to see if a particular parameter being passed was either an object or array.. and if not then was it a string/int and what I did was something like ``` if (str instanceof Array || str instanceof Object) { //code } else { //code } ``` anyone know of the equivalent to this for php?

Original source

Related problems