<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/_incl_data/__config.php'; $learning = new Learming(); //set getLearningStatus to 0 and save if ($_POST['hasLearned'] && $learning->hasLearned()) { echo 'OK'; } if ($_POST['getStatus']) { // boolean switch ($learning->getLearningStatus()) { case 0: echo 'should not learn'; break; case 1: echo 'should learn'; break; default: echo 'error: no data'; break; } }