function updateStatus($pid, $status_type, $status) { if (strpos($pid, 'ap-image:') > -1) { $success = AP_Image::setImageStatus($pid, $status_type, $status); } else { if (strpos($pid, 'ap-roi:') > -1) { $success = AP_ROI::setROIStatus($pid, $status_type, $status); } else { $success = false; } } if ($success != false) { echo '<status_successfully_updated>true</status_successfully_updated>'; //or whatever we want the return to be } else { echo '<status_successfully_updated>false</status_successfully_updated>'; //or whatever we want the return to be } }