Detail based on PHP options and use of information functions

  • 2020-06-03 06:01:17
  • OfStack

bool assert (mixed $assertion [, string $description]) - Checks whether 1 assertion is FALSE

assert_options(ASSERT_ACTIVE, true);// Allows the use of assert() function 
 assert_options(ASSERT_WARNING, false);// in assert No warning is printed on failure 
 assert_options(ASSERT_BAIL, true);//assert Terminates code execution after failure 
 assert_options(ASSERT_CALLBACK, 'getMsg');//assert Terminates code execution after failure. 

 echo ' Start: <br/>';
 echo ' Successful test! ';

 function getMsg(){
     echo ' Error! ';

mixed assert_options (int $what [, mixed $value]) - Sets various control options for assert(), or queries the current Settings
ASSERT_ACTIVE: Whether assert() assertion is enabled, ini configure, default value 1
ASSERT_WARNING: Whether to generate 1 PHP warning for each failed assertion, ini configure ES30en.warning, default 1
ASSERT_BAIL: Whether execution is aborted if the assertion fails, ini configure assert.bail with the default value 0
ASSERT_QUIET_EVAL: Whether to disable error_reporting when evaluating an assertion expression, ini configure ES45en.quiet_eval, default value 0
ASSERT_CALLBACK: The callback function is called when the assertion fails. ini configured assert.callback

assert_options(ASSERT_ACTIVE, true);// Allows the use of assert() function 
 assert_options(ASSERT_WARNING, false);// in assert No warning is printed on failure 
 assert_options(ASSERT_BAIL, true);//assert Terminates code execution after failure 
 assert_options(ASSERT_CALLBACK, 'getMsg');//assert Terminates code execution after failure. 

 echo ' Start: <br/>';
 assert(is_int(1.2));// The test result is fales
 echo ' Successful test! ';

 function getMsg(){
     echo ' Error! ';

bool dl(string $library) - Gets the value of the PHP configuration option to load the specified PHP extension

if(!extension_loaded('sqlite')){// Tests whether the specified extension is enabled 
     $prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
     dl($prefix . 'sqlite.' . PHP_SHLIB_SUFFIX);

int gc_collect_cycles() - force collection of all existing garbage cycles
void gc_disable (void) - Deactivation of the circular reference collector
void gc_enable (void) - Activate the circular reference collector
bool gc_enabled (void) - Returns the status of the loop reference counter
string get_cfg_var (string $option) -- 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 an array of module function names


string get_include_path (void) - Gets the current include_path configuration option
array get_included_files (void) - returns array with the include and require file names

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 array for 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 1 environment variable

$ip = getenv('REMOTE_ADDR');

int getlastmod (void) - Gets the time the page was last modified
int getmygid (void) - Gets the GID of the current PHP script owner
int getmyinode (void) - Gets the inodes of the current script (inode)
int getmypid (void) - Gets ID for the PHP process
int getmyuid (void) - Gets UID for the PHP script owner
array getopt (string $options [, array $longopts]) - Get the options from the command line argument list
array getrusage ([int $who = 0]) - Gets the current resource usage
array ini_get_all ([string $extension [, bool $details = true]]) -- get all configuration options


string ini_get (string $varname) - Gets the value of 1 configuration option
void ini_restore (string $varname) - Restore the default value of the configuration option
string ini_set (string $varname, string $newvalue) - Sets the value for 1 configuration option
main - Virtual main()int memory_ge

ak_usage ([bool $real_usage = false]) -- returns the peak value of int memory_get_usage ([bool $real_usage = false] allocated to PHP memory -- Returns the amount of memory allocated to PHP
string php_ini_loaded_file (void) - Gets the path to the loaded ES275en.ini file
string php_ini_scanned_files (void) - returns a list of.ini files parsed from the additional ini directory
string php_sapi_name (void) - Returns the interface type between the web server and PHP
string php_uname ([string $mode = "a"]) - Returns information about the system on which PHP is running
'a' : This is the default all.
's' : Operating system name
'n' : Host name. For example:
'r' : Version name, for example: 5.1.2-ES314en.
'v' : Version information. There are big differences between operating systems.
'm' : Machine type. For example: i386.
bool phpcredits ([int $flag = CREDITS_ALL]) - Print list of PHP contributors
CREDITS_DOCS: Document group contribution list
CREDITS_FULLPAGE: Often used in combination with other flags. Indicates that a separate HTML page containing additional flag representation information needs to be printed.
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: Server API module and author for PHP


bool phpinfo ([int $what = INFO_ALL]) - Outputs information about the PHP configuration
string phpversion ([string $extension]) - Gets the current version of PHP
bool putenv (string $setting) - Sets the value of the environment variable
void restore_include_path (void) - Restores the value of the include_path configuration option
string set_include_path (string $new_include_path) - Sets the include_path configuration option
void set_time_limit (int $seconds) - Sets the maximum execution time of the script, starting from itself, with 0 for unlimited time
string sys_get_temp_dir (void) - Returns the directory used for temporary files
mixed version_compare (string $version1, string $version2 [, string $operator]) - compare two PHP normalized version numeric strings

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 the only identifier for the current thread
string zend_version (void) - Gets the version of the current Zend engine

Related articles: