A detailed _php tutorial based on PHP options and the use of information functions

Source: Internet
Author: User
Tags number strings
bool assert(Mixed $assertion [, String $description])-Check whether an assertion is FALSE
Copy CodeThe code is as follows:
Assert_options (assert_active, true);//allow use of the ASSERT () function
Assert_options (assert_warning, false);//Do not output a warning message if the ASSERT fails
Assert_options (Assert_bail, true); terminating code execution after//assert failure
Assert_options (Assert_callback, ' getmsg '); Terminate code execution after//assert failure.

Echo ' Start:
';
Assert (' mysql_query (") ');
Echo ' Test was successful! ';

function getmsg () {
Echo ' ERROR! ';
}

Mixed Assert_options(int $what [, mixed $value])-Sets the various control options for the Assert (), or queries the current settings
Assert_active: Whether to enable assert () assertion, INI configuration assert.active, default value 1
Assert_warning: Whether to generate a PHP warning for each failed assertion, INI configuration assert.warning, default 1
Assert_bail: Whether to abort execution on assertion failure, INI configuration assert.bail, default value 0
Assert_quiet_eval: Whether Error_reporting,ini configuration assert.quiet_eval is disabled when an assertion expression is evaluated, default value 0
Assert_callback: Invoke callback function when assertion fails, INI config assert.callback
Copy CodeThe code is as follows:
Assert_options (assert_active, true);//allow use of the ASSERT () function
Assert_options (assert_warning, false);//Do not output a warning message if the ASSERT fails
Assert_options (Assert_bail, true); terminating code execution after//assert failure
Assert_options (Assert_callback, ' getmsg '); Terminate code execution after//assert failure.

Echo ' Start:
';
ASSERT (Is_int (1.2));//test result is Fales
Echo ' Test was successful! ';

function getmsg () {
Echo ' ERROR! ';
}

BOOL DL (string $library)-Gets the value of the PHP configuration option loaded into the specified PHP extension
Copy CodeThe code is as follows:
if (!extension_loaded (' SQLite ')) {//test specifies whether the extension has been activated
$prefix = (Php_shlib_suffix = = = ' dll ')? ' Php_ ': ';
DL ($prefix. ' SQLite. ' Php_shlib_suffix);
}

int Gc_collect_cycles ()-Forces the collection of all existing garbage cycle cycles
void gc_disable (void)-Deactivate circular reference collector
void gc_enable (void)-Activates the circular reference collector
BOOL Gc_enabled (void)-Returns the state of a circular reference counter
String Get_cfg_var (String $option)-Gets the value of the PHP configuration option to get the value of the PHP configuration option
String Get_current_user (void)-Gets the current PHP script owner name
Array get_defined_constants ([bool $categorize = false])-Returns an associative array of all constants
Array Get_extension_funcs (String $module _name)-Returns a block of module function names
Copy CodeThe code is as follows:
Print_r (Get_extension_funcs ("xml"));

String Get_include_path (void)-Gets the current include_path configuration option
Array get_included_files (void)-Returns an array of include and require file names
Copy CodeThe 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 an array of all compiled and loaded module names
BOOL Get_magic_quotes_gpc (void)-Gets the configuration option settings for 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)-Gets the value of an environment variable
Copy CodeThe code is as follows:
$ip = getenv (' remote_addr ');

int getlastmod (void)-Gets the last time the page was modified
int Getmygid (void)-Gets the GID of the current PHP script owner
int Getmyinode (void)-Gets the index node (inode) of the current script
int getmypid (void)-Gets the ID of the PHP process
int Getmyuid (void)-Gets the UID of the PHP script owner
Array getopt (string $options [, array $longopts])-Get options from the command-line argument list
Array getrusage ([int $who = 0])-Get current Resource usage
Array Ini_get_all ([string $extension [, bool $details = True]])-Get all configuration options
Copy CodeThe code is as follows:
Print_r (Ini_get_all ("Pcre"));
Print_r (Ini_get_all ());

String Ini_get (String $varname)-Gets the value of a configuration option
void Ini_restore (String $varname)-Restore default values for configuration options
String Ini_set (String $varname, String $newvalue)-sets a value for a configuration option
main-virtual main () int memory_get_peak_usage ([bool $real _usage = false])-Returns the peak int memory_get_usage assigned to PHP memory ([bool $r Eal_usage = false])-Returns the amount of memory allocated to PHP
String Php_ini_loaded_file (void)-Gets the path to the loaded php.ini file
String Php_ini_scanned_files (void)-Returns a list of. ini files parsed from an additional INI directory
String Php_sapi_name (void)-Returns the type of interface between the Web server and PHP
String Php_uname ([String $mode = "a"])-Returns information about the system running PHP
' A ': This is the default 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 is a big difference between the operating systems.
' m ': machine type. For example: i386.
BOOL Phpcredits ([int $flag = Credits_all])-Print PHP Contributors list
Credits_all: All
Credits_docs: Document Group Contribution list
Credits_fullpage: Commonly used in combination with other flags. Represents the need to print a separate HTML page that contains information about other flags.
Credits_general: Universal list: Language design and concepts, PHP authors, and SAPI modules
Credits_group: List of core developers
credits_modules:php Extension Module and author
Credits_sapi:php's server API module and author
Copy CodeThe code is as follows:
Phpcredits (Credits_group | Credits_docs | Credits_fullpage);

BOOL Phpinfo ([int $what = Info_all])-Output information about the PHP configuration
String Phpversion ([string $extension])-Gets the current PHP version
BOOL Putenv (String $setting)-Sets the value of an environment variable
void Restore_include_path (void)-Restores 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 a script, starting with its own timing, 0 means no Limit
String Sys_get_temp_dir (void)-Returns the directory used for temporary files
Mixed Version_compare (String $version 1, String $version 2 [, String $operator])-Compare two PHP normalized version number strings
Copy CodeThe 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)-Returns a unique identifier for the current thread
String zend_version (void)-Gets the version of the current Zend engine

http://www.bkjia.com/PHPjc/326992.html www.bkjia.com true http://www.bkjia.com/PHPjc/326992.html techarticle bool Assert (mixed $assertion [, String $description])-check if an assertion is FALSE to copy the code code as follows: Assert_options (assert_active, t Rue);//allow the use of the Assert () Letter ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.