I need something like this in php:
If (!command_exists(\'makemiracle\')) { print \'no miracles\'; return FALSE; } else { // safely call the command kno
Based on @jcubic and that 'which' should be avoided, this is the cross platform I came up with:
function verifyCommand($command) :bool { $windows = strpos(PHP_OS, 'WIN') === 0; $test = $windows ? 'where' : 'command -v'; return is_executable(trim(shell_exec("$test $command"))); }