Advertisement
villers

Untitled

Oct 26th, 2015
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. function check_types($my_array){
  4.     foreach ($my_array as $key => $value)
  5.         foreach ($my_array[$key] as $key2 => $value2)
  6.             if ($key2 != gettype($value2))
  7.                 return false
  8.     return true;
  9. }
  10.  
  11.  
  12.  
  13. $tab = ["integer"=> [5121,454, -5464],
  14.     "double" => [22.0, 262.65, -54.54],
  15.     "NULL"   => [NULL, NULL, NULL],
  16.     "string" => ["a", "a", "ab"],
  17.     "object" => [new stdClass()]];
  18.  
  19.  var_dump(check_types($tab));
  20.  
  21.  ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement