3v4l.org

run code in 300+ PHP versions simultaneously
<?php $lesson = array("143" => array("315", "311", "176", "145"), "13" => array("27", "25") ); $user = array( array("143" => array("145" => "1", "176" => "1")), array("13" => array("25" => "1")) ); $result = array(); foreach($user as $key => $value){ foreach($value as $key2 => $value2){ $result[$key2] = array_diff($lesson[$key2], array_keys($value2)); } } echo '<pre>'; print_r($result); echo '</pre>';

preferences:
25.02 ms | 406 KiB | 5 Q