This module allows the admin account (user 1) to add fields, filters and sorts to views which use PHP code. It also supports additional accounts when the core PHP Filter module is enabled.
This is the successor of Views Custom Field for both D6 and D7. The D6 version supports both Views 2 and Views 3.
While this module allows you to directly use PHP inside views which may be useful for quick and easy solutions, it is highly advisable to use regular handlers and plugins when available (or even to create one yourself). Take note that filtering and sorting a view using PHP always has a considerable perfomance impact.
An alternative to this module is Computed field. It lets you add an actual field to your entities where you specify the PHP code you'd like to run. You can store the computed result in the database or have it run on the fly when viewed directly or through Views. It also lets you implement hooks in your own modules which hold your computation code so it can be version controlled. Views PHP doesn't have this ability, but there's a feature request for this over at .
- An (header/footer/empty) area which output is constructed by the administrator using PHP.
- A field which value and/or output is constructed by the administrator using PHP. Click-sort is also available and accepts a number of predefined sort algorithms or custom PHP.
- A filter based on custom PHP code; use PHP to filter out any row.
- A sort based on custom PHP code; use PHP to sort the result of a view.
- Access control based on custom PHP code; use PHP to determine whether a user has access to a view.
- Cache control based on custom PHP code; use PHP to determine whether a view's (result/output) cache is still fresh.