Assert/zh

Assert是一个PHP函式庫，它提供了PHP的 的替代品，可以用简单且可靠的方法来检查PHP代码中的前条件和后条件. 它原本是作为一個MediaWiki RFC而提出的，但完全是通用的，且可以被任何PHP程序或函式庫使用.

使用
The Assert class provides several static methods for checking various kinds of assertions. The most common kind is to check the type of a parameter, typically in a constructor or a setter method:

Checking parameters, or other assertions such as pre- or postconditions, is not recommended for performance critical regions of the code, since evaluating expressions and calling the assertion functions costs time.