public static function stacktrace( $stack = null, $withPre = false )
	{
		if ( is_null( $stack ) )
			$stack = debug_backtrace();
		$output = $withPre ? '<pre>' : '';

		$stackLen = count( $stack );
		for ( $i = 1; $i < $stackLen; $i++ )
		{
			$entry = $stack[$i];

			$func = $entry['function'] . '(';
			$argsLen = count( $entry['args'] );

			for ( $j = 0; $j < $argsLen; $j++ )
			{
				$my_entry = $entry['args'][$j];

				if ( is_string( $my_entry ) )
					$func .= $my_entry;

				if ( $j < $argsLen - 1 )
					$func .= ', ';
			}
			$func .= ')';

			$entry_file = 'NO_FILE';

			if ( array_key_exists( 'file', $entry ) )
				$entry_file = $entry['file'];

			$entry_line = 'NO_LINE';

			if ( array_key_exists( 'line', $entry ) )
				$entry_line = $entry['line'];

			$output .= $entry_file . ':' . $entry_line . ' - ' . $func . PHP_EOL;
		}

		if ( $withPre )
			$output .= $output . '</pre>';

		return $output;
	}
public static function stacktrace( $stack = null, $withPre = false )
	{
		if ( is_null( $stack ) )
			$stack = debug_backtrace();
		$output = $withPre ? '<pre>' : '';

		$stackLen = count( $stack );
		for ( $i = 1; $i < $stackLen; $i++ )
		{
			$entry = $stack[$i];

			$func = $entry['function'] . '(';
			$argsLen = count( $entry['args'] );

			for ( $j = 0; $j < $argsLen; $j++ )
			{
				$my_entry = $entry['args'][$j];

				if ( is_string( $my_entry ) )
					$func .= $my_entry;

				if ( $j < $argsLen - 1 )
					$func .= ', ';
			}
			$func .= ')';

			$entry_file = 'NO_FILE';

			if ( array_key_exists( 'file', $entry ) )
				$entry_file = $entry['file'];

			$entry_line = 'NO_LINE';

			if ( array_key_exists( 'line', $entry ) )
				$entry_line = $entry['line'];

			$output .= $entry_file . ':' . $entry_line . ' - ' . $func . PHP_EOL;
		}

		if ( $withPre )
			$output .= $output . '</pre>';

		return $output;
	}
public static function stacktrace ( $ stack = null , $ withPre = false ) { if ( is_null ( $ stack ) ) $ stack = debug_backtrace ( ) ; $ output = $ withPre ? '<pre>' : '' ; $ stackLen = count ( $ stack ) ; for ( $ i = 1 ; $ i < $ stackLen ; $ i ++ ) { $ entry = $ stack [ $ i ] ; $ func = $ entry [ 'function' ] . '(' ; $ argsLen = count ( $ entry [ 'args' ] ) ; for ( $ j = 0 ; $ j < $ argsLen ; $ j ++ ) { $ my_entry = $ entry [ 'args' ] [ $ j ] ; if ( is_string ( $ my_entry ) ) $ func .= $ my_entry ; if ( $ j < $ argsLen - 1 ) $ func .= ', ' ; } $ func .= ')' ; $ entry_file = 'NO_FILE' ; if ( array_key_exists ( 'file' , $ entry ) ) $ entry_file = $ entry [ 'file' ] ; $ entry_line = 'NO_LINE' ; if ( array_key_exists ( 'line' , $ entry ) ) $ entry_line = $ entry [ 'line' ] ; $ output .= $ entry_file . ':' . $ entry_line . ' - ' . $ func . PHP_EOL ; } if ( $ withPre ) $ output .= $ output . '</pre>' ; return $ output ; }
Creates a human readable stack trace

@param null $stack
@return string
Creates a human readable stack trace