php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #4327 feature request: assert()
Submitted: 2000-05-04 12:23 UTC Modified: 2000-05-04 12:26 UTC
From: jeff at jab dot org Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0 Release Candidate 1 OS: linux
Private report: No CVE-ID: None
 [2000-05-04 12:23 UTC] jeff at jab dot org
C has a function called assert(booean test), such
that if the test if false,  execution is halted
and a callstack is printed, including file and line
numbers. If the test is true, no action is taken.
It is useful for locating bugs in code.

For example, a function that takes argument int x
which should be positive can have in it's code:
   assert( x > 0 );

I'd very much like to see such a feature added to
PHP4, as PHP3 is sorely lacking in this area.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-05-04 12:26 UTC] andrei at cvs dot php dot net
Already implemented. It allows you to do even more stuff than
C's assert(). Try setting assert.active = 1 in your php.ini.

 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Jun 16 15:00:02 2026 UTC