if statement - Shorthand If / Else require_once PHP -


so here's code. works when use longer if statement, not when use shorthand. sorry bad english.

<?php   function __autoload($class) {      $path = "includes/{$class}.php";      // works       if (file_exists($path)) {          require_once($path);       }       else {          die("file not found :(");       }      //but not      require_once() file_exists($path) ? $path : die("file not found :(");  }  ?> 

file_exists($path) ? require_once($path) : die('file not found');

but think, shorthand if statement proper assign variables. i'd write code like;

try {     require_once($path);  } catch (exception $e) {     die('file not found'); }