<?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>';
- Output for 5.5.0 - 5.5.35, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
- <pre>Array
(
[143] => Array
(
[0] => 315
[1] => 311
)
[13] => Array
(
[0] => 27
)
)
</pre>
preferences:
58.73 ms | 408 KiB | 5 Q