downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Lisa tipurilor de resurse> <Clase predefinite
[edit] Last updated: Fri, 25 May 2012

view this page in

Constante predefinite

Constantele predefinite de bază

Aceste constante sunt definite de nucleul PHP. Aceasta include PHP, motorul Zend și modulele SAPI.

PHP_VERSION (string)
PHP_MAJOR_VERSION (integer)
Disponibilă începând cu PHP 5.2.7.
PHP_MINOR_VERSION (integer)
Disponibilă începând cu PHP 5.2.7.
PHP_RELEASE_VERSION (integer)
Disponibilă începând cu PHP 5.2.7.
PHP_VERSION_ID (integer)
Disponibilă începând cu PHP 5.2.7.
PHP_EXTRA_VERSION (string)
Disponibilă începând cu PHP 5.2.7.
PHP_ZTS (integer)
Disponibilă începând cu PHP 5.2.7.
PHP_DEBUG (integer)
Disponibilă începând cu PHP 5.2.7.
PHP_MAXPATHLEN (integer)
Disponibilă începând cu PHP 5.3.0.
PHP_OS (string)
PHP_SAPI (string)
Disponibilă începând cu PHP 4.2.0. Vedeți de asemenea php_sapi_name().
PHP_EOL (string)
Disponibilă începând cu PHP 4.3.10 și PHP 5.0.2
PHP_INT_MAX (integer)
Disponibilă începând cu PHP 4.4.0 și PHP 5.0.5
PHP_INT_SIZE (integer)
Disponibilă începând cu PHP 4.4.0 și PHP 5.0.5
DEFAULT_INCLUDE_PATH (string)
PEAR_INSTALL_DIR (string)
PEAR_EXTENSION_DIR (string)
PHP_EXTENSION_DIR (string)
PHP_PREFIX (string)
Disponibilă începând cu PHP 4.3.0
PHP_BINDIR (string)
PHP_LIBDIR (string)
PHP_DATADIR (string)
PHP_SYSCONFDIR (string)
PHP_LOCALSTATEDIR (string)
PHP_CONFIG_FILE_PATH (string)
PHP_CONFIG_FILE_SCAN_DIR (string)
PHP_SHLIB_SUFFIX (string)
Disponibilă începând cu PHP 4.3.0
PHP_OUTPUT_HANDLER_START (integer)
PHP_OUTPUT_HANDLER_CONT (integer)
PHP_OUTPUT_HANDLER_END (integer)
PHP_WINDOWS_VERSION_MAJOR (integer)
Disponibilă începând cu PHP 5.3.0
PHP_WINDOWS_VERSION_MINOR (integer)
Disponibilă începând cu PHP 5.3.0
PHP_WINDOWS_VERSION_BUILD (integer)
Disponibilă începând cu PHP 5.3.0
PHP_WINDOWS_VERSION_PLATFORM (integer)
Disponibilă începând cu PHP 5.3.0
PHP_WINDOWS_VERSION_SP_MAJOR (integer)
Disponibilă începând cu PHP 5.3.0
PHP_WINDOWS_VERSION_SP_MINOR (integer)
Disponibilă începând cu PHP 5.3.0
PHP_WINDOWS_VERSION_SUITEMASK (integer)
Disponibilă începând cu PHP 5.3.0
PHP_WINDOWS_VERSION_PRODUCTTYPE (integer)
Disponibilă începând cu PHP 5.3.0
PHP_WINDOWS_NT_DOMAIN_CONTROLLER (integer)
Disponibilă începând cu PHP 5.3.0
PHP_WINDOWS_NT_SERVER (integer)
Disponibilă începând cu PHP 5.3.0
PHP_WINDOWS_NT_WORKSTATION (integer)
Disponibilă începând cu PHP 5.3.0
E_ERROR (integer)
E_WARNING (integer)
E_PARSE (integer)
E_NOTICE (integer)
E_CORE_ERROR (integer)
E_CORE_WARNING (integer)
E_COMPILE_ERROR (integer)
E_COMPILE_WARNING (integer)
E_USER_ERROR (integer)
E_USER_WARNING (integer)
E_USER_NOTICE (integer)
E_DEPRECATED (integer)
Disponibilă începând cu PHP 5.3.0
E_USER_DEPRECATED (integer)
Disponibilă începând cu PHP 5.3.0
E_ALL (integer)
E_STRICT (integer)
Disponibilă începând cu PHP 5.0.0
__COMPILER_HALT_OFFSET__ (integer)
Disponibilă începând cu PHP 5.1.0
TRUE (boolean)
Vedeți Booleene.
FALSE (boolean)
Vedeți Booleene.
NULL (boolean)
Vedeți Null.

Vedeți de asemenea Constante magice.

Constante standard predefinite

Toate constantele din cadrul extensiilor de bază sunt definite în PHP în mod implicit.



Lisa tipurilor de resurse> <Clase predefinite
[edit] Last updated: Fri, 25 May 2012
 
add a note add a note User Contributed Notes Constante predefinite
soywiz at gmail dot com 19-Jan-2009 03:32
Another way to determine PHP_INT_MIN:

<?php
define
('PHP_INT_MIN', ~PHP_INT_MAX);
?>

It should work always:

MAX for 8bit-signed: 01111111
MIN for 8bit-signed: 10000000

In 32 bits:
php -r"echo (int)base_convert(str_repeat('1', 31), 2, 10) - PHP_INT_MAX;"
0
<?php echo ~(int)base_convert(str_repeat('1', 31), 2, 10); ?>
-2147483648
isonomia 08-May-2008 05:18
As PHP_INT_MAX is only available since PHP 4.4.0 and PHP 5.0.5 here is a function that should enable sensible values on most machines (16,32 & 64bit):-

<?php
function get_int_max()
{
   
$max=0x7fff;
   
$probe = 0x7fffffff;
    while (
$max == ($probe>>16))
    {
       
$max = $probe;
       
$probe = ($probe << 16) + 0xffff;
    }
    return
$max;
}

if (!
defined('PHP_INT_MAX'))
{
   
define ('PHP_INT_MAX', get_int_max());
}
define ('PHP_INT_MIN', (int)(PHP_INT_MAX+1));
?>
monky at kymp dot net 12-Jan-2008 11:55
You can get minimum integer size by adding 1 to PHP_INT_MAX. Just remember to use casting.

<?php

echo (int)(PHP_INT_MAX+1);

?>
Tea Bore 28-Sep-2005 12:09
Use get_defined_constants() to retrieve these constants.

<?php

print '<pre>';
print_r(get_defined_constants());
print
'</pre>';

?>

 
show source | credits | stats | sitemap | contact | advertising | mirror sites