1

i have an array which could look like this:

 $config[$name][$array]['key'] = 'value'; // here it's an array

or

 $config[$name][$array] = 'value'; // here it's not an array

i want to check if the second array key ('array') is an array or not.

could someone help me?

2 Answers 2

7

use the function is_array http://php.net/manual/en/function.is-array.php

if(is_array($config[$name][$array])) echo "Yup I'm an array";
Sign up to request clarification or add additional context in comments.

Comments

2

PHP has a built in function, is_array. That should let you know whether or not you have an array, or a plain string.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.