3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $original = ['test' => 'test', 'test2'=>'another test', 'test3' => 'third test']; $address = ['test' => 'test', 'test2'=>'another test', 'test3' => 'third test diff', 'test4' => 'ignore me bro']; $changes = array_filter($original, function ($key, $data) use ($address) { return $data === $address->getData($key); }, ARRAY_FILTER_USE_BOTH); var_dump($changes);
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to a member function getData() on array in /in/9vLKU:8 Stack trace: #0 [internal function]: {closure}('test', 'test') #1 /in/9vLKU(9): array_filter(Array, Object(Closure), 1) #2 {main} thrown in /in/9vLKU on line 8
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Fatal error: Call to a member function getData() on array in /in/9vLKU on line 8
Process exited with code 255.
Output for 5.4.1 - 5.5.35
Notice: Use of undefined constant ARRAY_FILTER_USE_BOTH - assumed 'ARRAY_FILTER_USE_BOTH' in /in/9vLKU on line 9 Warning: array_filter() expects at most 2 parameters, 3 given in /in/9vLKU on line 9 NULL
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/9vLKU on line 3
Process exited with code 255.