note 113276 added to function.assert

From: Date: Fri, 20 Sep 2013 00:35:37 +0000
Subject: note 113276 added to function.assert
Groups: php.notes 
Request: Send a blank email to php-notes+get-196319@lists.php.net to get a copy of this message
Example from Ikac Framework how they use assert() <?php /** * Set Assertion Debug * * This method will check the given assertion and take appropriate - * action if its result is FALSE. * * This file is part of Ikac Framework. * * @package Ikac Framework * @author Ivan Stojmenovic Ikac <contact.@stojmenovic.info> * * @param mixed $assertion The assertion. * @param mixed $callback Callback to call on failed assertions * @param array $options Set the various control options or just query their current settings. * @param string $description An optional description that will be included in the failure message if the assertion fails. */ public function setAssertionDebug($assertion, $callback, array $options, $description = null) { if (is_array($options)) { foreach ($options AS $option => $value) { assert_options($option, $value); } } if ($callback) { assert_options(ASSERT_CALLBACK, $callback); } return assert($assertion, $description); } ?> How to use: <?php use Ikac\Component\SystemBehaviour\OptionsInfo; $system = new OptionsInfo(); $option = array(ASSERT_ACTIVE => 1,ASSERT_WARNING => 0,ASSERT_QUIET_EVAL => 1); $system->setAssertionDebug('2<1', function(){ echo "Assertion failed"; }, $option); ?> ---- Server IP: 69.147.83.199 Probable Submitter: 89.216.149.21 ---- Manual Page -- http://php.net/manual/en/function.assert.php Edit -- https://master.php.net/note/edit/113276 Del: integrated -- https://master.php.net/note/delete/113276/integrated Del: useless -- https://master.php.net/note/delete/113276/useless Del: bad code -- https://master.php.net/note/delete/113276/bad+code Del: spam -- https://master.php.net/note/delete/113276/spam Del: non-english -- https://master.php.net/note/delete/113276/non-english Del: in docs -- https://master.php.net/note/delete/113276/in+docs Del: other reasons-- https://master.php.net/note/delete/113276 Reject -- https://master.php.net/note/reject/113276 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#196319) next »