문제

I may have the following types of arrays:

array(
  'key' => array(),
   array(),
)

or ...

array(
  'key' => array(),
  'key' => value
)

and essentially I am looking to do something like:

foreach($array as $something){
  // if $something has a key
     // do something
  // if $something is an array
     // do something
}

Whats the cleanest and most OOP way to handle this type of issue?

올바른 솔루션이 없습니다

다른 팁

The code you have supplied has nothing to do with OOP but judging by the comments in your code you may want to look at is_array() and isset()

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top