View difference between Paste ID: aZ6H0fAV and vCTarLuJ
SHOW: | | - or go back to the newest paste.
1
<?php 
2
3-
function check_types($types) {
3+
function check_types($my_array){
4
	foreach ($my_array as $key => $value)
5-
	foreach($type as $key => $value) {
5+
		foreach ($my_array[$key] as $key2 => $value2)
6-
		foreach ($value as $val) {
6+
			if ($key2 != gettype($value2))
7-
			if ($key == gettype($val)) {
7+
				return false
8
	return true;
9-
			}
9+
}
10-
			return true;
10+
11-
		}
11+
12-
	}
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
 ?>