fork(4) download
  1. <?php
  2.  
  3. function matchKeys($testArray) {
  4. $match = ['id', 'name', 'age', 'email', 'password', 'birthday', 'ip', 'time', 'token', 'sourse'];
  5. sort($match);
  6. $keys = array_keys($testArray);
  7. sort($keys);
  8. return ($keys == $match);
  9. }
  10.  
  11. $test1=['id'=>'2', 'name'=>'user', 'age'=>'27', 'email'=>'user@2ch.so',
  12. 'password'=>'gayporn', 'birthday'=>'1.4.88', 'ip'=>'127.0.0.1',
  13. 'time'=>'12:22', 'token'=>'wtf_is_that?', 'sourse'=>'saem_shit'];
  14.  
  15. $test2=['id'=>'1', 'name'=>'newuser', 'age'=>'27', 'email'=>'admin@2ch.so',
  16. 'password'=>'gayporn', 'birthday'=>'1.4.88', 'ip'=>'127.0.0.1',
  17. 'time'=>'12:22', 'sourse'=>'saem_shit'];
  18.  
  19. $test3 = $test1;
  20. shuffle($test1);
  21.  
  22.  
  23.  
  24. $a = matchKeys($test1);
  25. $b = matchKeys($test2);
  26. $c = matchKeys($test3);
  27.  
  28. var_dump($a,$b,$c);
  29.  
  30. ?>
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
bool(false)
bool(false)
bool(true)