Describes how to use PHP options and information functions. Boolassert (mixed $ assertion [, string $ description])-check whether an asserted is FALSE. copy the code as follows: assert_options (ASSERT_ACTIVE, true); allow the use of the assert () function bool
Assert(Mixed $ assertion [, string $ description])-check whether an asserted is
FALSE
The code is as follows:
Assert_options (ASSERT_ACTIVE, true); // allows the use of the assert () function
Assert_options (ASSERT_WARNING, false); // no warning message is output when the assert fails.
Assert_options (ASSERT_BAIL, true); // terminate code execution after assert fails.
Assert_options (ASSERT_CALLBACK, 'getmsg '); // terminate code execution after assert fails.
Echo 'start:
';
Assert ('MySQL _ query ("")');
Echo 'test successful! ';
Function getMsg (){
Echo 'error! ';
}
Mixed assert_options(Int $ what [, mixed $ value])-set various control options for assert () or query the current settings
ASSERT_ACTIVE: whether to enable assert () assertions. ini configures assert. active. the default value is 1.
ASSERT_WARNING: whether to generate a PHP warning for each failed ASSERT_WARNING. the default value is 1 when assert. warning is configured in ini.
ASSERT_BAIL: indicates whether to stop execution when the ASSERT_BAIL assertion fails. ini configures assert. bail. the default value is 0.
ASSERT_QUIET_EVAL: whether to disable error_reporting when the asserted expression is evaluated. ini configures assert. quiet_eval. the default value is 0.
ASSERT_CALLBACK: the callback function is called when the assertions fail. ini configures assert. callback.
The code is as follows:
Assert_options (ASSERT_ACTIVE, true); // allows the use of the assert () function
Assert_options (ASSERT_WARNING, false); // no warning message is output when the assert fails.
Assert_options (ASSERT_BAIL, true); // terminate code execution after assert fails.
Assert_options (ASSERT_CALLBACK, 'getmsg '); // terminate code execution after assert fails.
Echo 'start:
';
Assert (is_int (1.2); // The detection result is fales.
Echo 'test successful! ';
Function getMsg (){
Echo 'error! ';
}
Bool dl (string $ library)-Get the PHP configuration option value and load the specified PHP extension
The code is as follows:
If (! Extension_loaded ('sqlite ') {// test whether the specified extension has been activated
$ Prefix = (PHP_SHLIB_SUFFIX = 'dll ')? 'Php _':'';
Dl ($ prefix. 'sqlite. '. PHP_SHLIB_SUFFIX );
}
Int gc_collect_cycles ()-Forces collection of all existing garbage cycle
Void gc_disable (void)-disable cyclic reference collector
Void gc_enable (void)-activate the cyclic reference collector
Bool gc_enabled (void)-return the status of the cyclic reference counter
String get_cfg_var (string $ option)-get the value of the PHP configuration option to get the value of the PHP configuration option
String get_current_user (void)-get the name of the current PHP script owner
Array get_defined_constants ([bool $ categorize = false])-returns the joined array of all constants.
Array get_extension_funcs (string $ module_name)-returns the array of the module function name
The code is as follows:
Print_r (get_extension_funcs ("xml "));
String get_include_path (void)-get the current include_path configuration option
Array get_included_files (void)-returns the array with the names of include and require files
The code is as follows:
Include 'test1. php ';
Include_once 'test2. php ';
Require 'test3. php ';
Require_once 'test4. php ';
$ Included_files = get_included_files ();
Foreach ($ included_files as $ filename ){
Echo "$ filename \ n ";
}
Array get_loaded_extensions ([bool $ zend_extensions = false])-returns the array of all compiled and loaded module names.
Bool get_magic_quotes_gpc (void)-Get the configuration option settings of the current magic_quotes_gpc
Bool get_magic_quotes_runtime (void)-gets the activation status of the current magic_quotes_runtime configuration option
String getenv (string $ varname)-obtains the value of an environment variable.
The code is as follows:
$ Ip = getenv ('remote _ ADDR ');
Int getlastmod (void)-get the last modification time of the page
Int getmygid (void)-Get the GID of the current PHP script owner
Int getmyinode (void)-Get the index node (inode) of the current script)
Int getmypid (void)-Get the PHP process ID
Int getmyuid (void)-Get the UID of the PHP script owner
Array getopt (string $ options [, array $ longopts])-obtain the option from the command line parameter list
Array getrusage ([int $ who = 0])-get the current resource usage
Array ini_get_all ([string $ extension [, bool $ details = true])-Get all configuration options
The code is as follows:
Print_r (ini_get_all ("pcre "));
Print_r (ini_get_all ());
String ini_get (string $ varname)-obtains the value of a configuration option.
Void ini_restore (string $ varname)-default value of the restore configuration option
String ini_set (string $ varname, string $ newvalue)-set a value for a configuration option
Main-virtual main () int memory_get_peak_usage ([bool $ real_usage = false])-return the peak int memory_get_usage ([bool $ real_usage = false]) allocated to the PHP memory. -the amount of memory allocated to PHP is returned.
String php_ini_loaded_file (void)-obtain the path of the loaded php. ini file
String php_ini_scanned_files (void)-returns the List of. ini files parsed from the extra ini directory.
String php_sapi_name (void)-return the interface type between the web server and PHP.
String php_uname ([string $ mode = "a"])-returns information about the system running PHP.
'A': The default value is all.
'S ': Operating system name
'N': host name. For example, localhost.example.com.
'R': version name, for example, 5.1.2-RELEASE.
'V': version information. There are major differences between operating systems.
'M': Machine type. For example, i386.
Bool phpcredits ([int $ flag = CREDITS_ALL])-print the PHP contributor list
CREDITS_ALL: all
CREDITS_DOCS: document group contribution list
CREDITS_FULLPAGE: used in combination with other labels. To print an independent HTML page containing other tags.
CREDITS_GENERAL: General list: language design and philosophy, PHP author, and SAPI module
CREDITS_GROUP: list of core developers
CREDITS_MODULES: PHP extension module and author
CREDITS_SAPI: PHP Server API module and author
The code is as follows:
Phpcredits (CREDITS_GROUP | CREDITS_DOCS | CREDITS_FULLPAGE );
Bool phpinfo ([int $ what = INFO_ALL])-Output information about PHP configuration
String phpversion ([string $ extension])-get the current PHP version
Bool putenv (string $ setting)-set the value of the environment variable
Void restore_include_path (void)-restore the value of the include_path configuration option
String set_include_path (string $ new_include_path)-set include_path configuration options
Void set_time_limit (int $ seconds)-sets the maximum execution time of the script, starting from its own time. 0 indicates the time limit.
String sys_get_temp_dir (void)-return the directory used for temporary files
Mixed version_compare (string $ version1, string $ version2 [, string $ operator])-compare two standardized PHP version numeric strings
The code is as follows:
If (version_compare (PHP_VERSION, '5. 3.0 ')> = 0 ){
Echo 'My PHP version is very high: '. PHP_VERSION. "\ n ";
}
Int zend_thread_id (void)-return the unique identifier of the current thread
String zend_version (void)-get the current Zend Engine version
Http://www.bkjia.com/PHPjc/326992.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/326992.htmlTechArticlebool assert (mixed $ assertion [, string $ description])-check whether an asserted is FALSE code as follows: assert_options (ASSERT_ACTIVE, true); // allow the use of assert () letter...