Ok then. I have a filled array defined like this:
$subs = array();
for (...) {
// extracting of variables $knowledgeLevel, $name, $short, $long
$subs [] = array (
'knowledgeLevel' => $knowledgeLevel,
'name' => $name,
'shortTheory' => $short,
'longTheory' => $long
);
}
then I receive a value $kl
, and I want to eventually delete from the array $subs
the element
that has the knowledgeLevel
equal to $kl
. I've tried to do so:
foreach ( $subs as $subject ) {
if ($subject['knowledgeLevel'] == $kl) {
unset ($subject);
}
}
and so
foreach ( $subs as $subject ) {
if ($subject['knowledgeLevel'] == $kl) {
unset ($subject['knowledgeLevel']);
unset ($subject['name']);
unset ($subject['shortTheory']);
unset ($subject['longTheory']);
}
}
but these don't seem to work.
$kl
defined?$subs
array? It's a numeric array, not associative. Its elements are associative arrays.$kl
is the parameter of the second function