I'm a beginner in PHP, so basically I have an array with no key specified and only values which are arrays. I want to get the name of people who are going to the springbreak (== true). I've tried this but it's not working ...
$liste = [
['name' => 'Elsa', 'job' => 'Student', 'springbreak' => 'true' ],
['name' => 'Chris', 'job' => 'Teacher', 'springbreak' => 'true' ],
['name' => 'Zob', 'job' => 'Student', 'springbreak' => 'false' ],
['name' => 'Ken', 'job' => 'Teacher', 'springbreak' => 'true' ],
['name' => 'Ryan', 'job' => 'Student', 'springbreak' => 'false' ],
['name' => 'Tenta', 'job' => 'Teacher', 'springbreak' => 'true' ]
];
foreach($liste as $line){
foreach($line as $value){
if ($value['springbreak'] == true)
echo $value['name'];
}
}
the output should be : Elsa,Chris,Ken,Tenta