I am learning PHP. I have downloaded an open source project from a website and looking the workflow of each modules in that project. I noticed a switch case which is unfamiliar to me.
switch ($value) {
case 'student':
case StudentClass::getInstance()->getId();
return new StudentClass();
break;
case 'teacher':
case TeacherClass::getInstance()->getId();
return new TeacherClass();
break;
default:
break;
}
The above patch is what I looked. When I give input:
$value = 'student';
It returns StudentClass instance.
If I give
$value = 'teacher';
then it returns TeacherClass instance.
If anyone explain the flow, it will be helpful to me to understanding PHP much better