Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...

When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Common Instance Methods

Every instance of a Zend_Uri subclass (e.g. Zend_Uri_Http) has several instance methods that are useful for working with any kind of URI.

Getting the Scheme of the URI

The scheme of the URI is the part of the URI that precedes the colon. For example, the scheme of is 'http'.

Example 988. Getting the Scheme from a Zend_Uri_* Object


$scheme $uri->getScheme();  // "http"

The getScheme() instance method returns only the scheme part of the URI object.

Getting the Entire URI

Example 989. Getting the Entire URI from a Zend_Uri_* Object


$uri->getUri();  // ""

The getUri() method returns the string representation of the entire URI.

Validating the URI

Zend_Uri::factory() will always validate any URI passed to it and will not instantiate a new Zend_Uri subclass if the given URI is found to be invalid. However, after the Zend_Uri subclass is instantiated for a new URI or an existing valid one, it is possible that the URI can later become invalid after it is manipulated.

Example 990. Validating a Zend_Uri_* Object


$isValid $uri->valid();  // TRUE

The valid() instance method provides a means to check that the URI object is still valid.

Zend Framework