dexen
public php v1 · immutable /** Throws \p $exceptionClass in case of failure of \p $callback . Throws \p $exceptionClass with message as printed by callable \p $callback when the returned value equals \p $condition . */ function throwError( $callback, $parms, $exceptionClass, $condition = FALSE ) { if ( $parms === NULL ) $parms = array(); ob_start(); $v = call_user_func_array( $callback, $parms ); $e = ob_get_clean(); if ( $v === $condition ) throw new $exceptionClass( $e ); return $v; }