I am trying to rewrite a python script in php.
The python script is handling the KeyboardInterrupt
exception this way :
except KeyboardInterrupt: pass
I was starting with this, but can't figure out what to put for ???
} catch (Exception $e) {
if ($e->getCode() == ??? ) {
//I have nothing to do but I could
}
}
I hoped to find something in the doc in the runtime exceptions https://www.php.net/manual/en/class.runtimeexception.php but I found nothing relevant. I also found this for php 7.4+ on windows (but is involving a quite new version of php and restricted on windows) PHP CLI in Windows: Handling Ctrl-C commands?
Is there a cross-platform way to catch this exception in php ? and if yes, how ? Is there a documented list of php builtin exceptions (code and message)?