Skip to content

Commit 7955b31

Browse files
committed
Add example for float constant
1 parent 689cf27 commit 7955b31

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

ext/standard/basic_functions.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
292292
# endif
293293
#endif
294294

295+
register_basic_functions_consts(module_number);
296+
295297
php_ce_incomplete_class = register_class___PHP_Incomplete_Class();
296298
php_register_incomplete_class_handlers();
297299

@@ -322,7 +324,6 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
322324
REGISTER_LONG_CONSTANT("PHP_QUERY_RFC3986", PHP_QUERY_RFC3986, CONST_CS | CONST_PERSISTENT);
323325

324326
#define REGISTER_MATH_CONSTANT(x) REGISTER_DOUBLE_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT)
325-
REGISTER_MATH_CONSTANT(M_E);
326327
REGISTER_MATH_CONSTANT(M_LOG2E);
327328
REGISTER_MATH_CONSTANT(M_LOG10E);
328329
REGISTER_MATH_CONSTANT(M_LN2);

ext/standard/basic_functions.stub.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
/** @generate-class-entries */
44

5+
/**
6+
* @var float
7+
* @cname M_E
8+
*/
9+
const M_E = 2.7182818284590452354;
10+
511
final class __PHP_Incomplete_Class
612
{
713
}

ext/standard/basic_functions_arginfo.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: b1c51fabe59bba6706500365f3eb7d9676d625f6 */
2+
* Stub hash: 29f2ff95da2c07a61f23729da63ada536d2980d1 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
55
ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
@@ -3515,6 +3515,12 @@ static const zend_function_entry class_AssertionError_methods[] = {
35153515
ZEND_FE_END
35163516
};
35173517

3518+
static void register_basic_functions_consts(int module_number)
3519+
{
3520+
REGISTER_DOUBLE_CONSTANT("M_E", M_E, CONST_CS | CONST_PERSISTENT);
3521+
ZEND_ASSERT(M_E == 2.7182818284590451);
3522+
}
3523+
35183524
static zend_class_entry *register_class___PHP_Incomplete_Class(void)
35193525
{
35203526
zend_class_entry ce, *class_entry;

0 commit comments

Comments
 (0)