/** * bool i5_userspace_create(properties[, resource connection]). * Description: Creates a new user space object. * Return Values: Boolean success value * Arguments: * properties - * I5_INITSIZE - The initial size of the user space being created. This value must be from 1 byte to 16, 776, 704 bytes. * I5_DESCRIPTION - user space description * I5_INIT_VALUE - The initial value of all bytes in the user space. * I5_EXTEND_ATTRIBUT - extended attribute. The extended attribute must be a valid *NAME. For example, an object type of *FILE has an extended attribute of PF (physical file), LF (logical file), DSPF (display file), SAVF (save file), and so on. * I5_AUTHORITY - The authority you give users who do not have specific private or group authority to the user space * I5_LIBNAME - Library name where the user space is located * I5_NAME - User space name (10 char max) * connection - Result of i5_connect * * example: * $property = array( * I5_INITSIZE=>10, * I5_DESCRIPTION=>"Created by PHP", * I5_INIT_VALUE=>"A", * I5_EXTEND_ATTRIBUT=>"File", * I5_AUTHORITY=>"*ALL", * I5_LIBNAME=>"PHPDEMO", * I5_NAME=>"USERSPACE" * ); * * @param array $properties * @param null $connection * @return bool */ function i5_userspace_create($properties = array(), $connection = null) { if (!($connection = verifyConnection($connection))) { return false; } // check incoming $properties array if (!$properties || !is_array($properties)) { i5ErrorActivity(I5_ERR_PHP_TYPEPARAM, I5_CAT_PHP, 'Properties must be an array', 'Properties must be an array'); return false; } // name and library are the only required properties if (!isset($properties[I5_LIBNAME]) || !$properties[I5_NAME]) { i5ErrorActivity(I5_ERR_PHP_TYPEPARAM, I5_CAT_PHP, 'Library and name are required', 'Library and name are required'); return false; } // @todo check initsize numeric, init_value single char, nonblank for other supplied properties // get values in fields to pass to toolkit $possibleProperties = array(I5_INITSIZE, I5_DESCRIPTION, I5_INIT_VALUE, I5_EXTEND_ATTRIBUT, I5_AUTHORITY, I5_LIBNAME, I5_NAME); $options = array(); foreach ($possibleProperties as $possProp) { // assign either the propery or '' to each property in array $options[$possProp] = isset($properties[$possProp]) ? $properties[$possProp] : ''; } // use Zend API toolkit create user space method $usObj = new UserSpace($connection); $success = $usObj->CreateUserSpace($options[I5_NAME], $options[I5_LIBNAME], $options[I5_INITSIZE], $options[I5_AUTHORITY], $options[I5_INIT_VALUE], $options[I5_EXTEND_ATTRIBUT], $options[I5_DESCRIPTION]); if (!$success) { i5CpfError($connection->getErrorCode(), $connection->getErrorMsg()); return false; } else { noError(); return true; } }
} echo 'error suppression (no error): '; $start = microtime(true); for ($i = 0; $i < $max; $i++) { $rs = @noError(); if (!$rs) { // never called } } $end = microtime(true); echo $end - $start . PHP_EOL; echo 'error handler (no error): '; $start = microtime(true); for ($i = 0; $i < $max; $i++) { set_error_handler('tmpErrorHandler'); $rs = noError(); restore_error_handler(); if (!$rs) { // never called } } $end = microtime(true); echo $end - $start . PHP_EOL; echo 'error suppression (use last error): '; $start = microtime(true); for ($i = 0; $i < $max; $i++) { $rs = @triggerError(); if (!$rs) { $err = error_get_last(); $globalLastErrorMsg = $err['message']; // do somethink with $globalLastErrorMsg