File tree Expand file tree Collapse file tree 5 files changed +51
-0
lines changed Expand file tree Collapse file tree 5 files changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ PHP NEWS
12
12
(Nikita Popov)
13
13
14
14
- Core:
15
+ . Added boolval(). (Jille Timmermans).
15
16
. Fixed bug #61681 (Malformed grammar). (Nikita Popov, Etienne, Laruence).
16
17
. Fixed bug #61038 (unpack("a5", "str\0\0") does not work as expected).
17
18
(srgoogleguy, Gustavo)
Original file line number Diff line number Diff line change @@ -2522,6 +2522,10 @@ ZEND_BEGIN_ARG_INFO(arginfo_strval, 0)
2522
2522
ZEND_ARG_INFO (0 , var )
2523
2523
ZEND_END_ARG_INFO ()
2524
2524
2525
+ ZEND_BEGIN_ARG_INFO (arginfo_boolval , 0 )
2526
+ ZEND_ARG_INFO (0 , var )
2527
+ ZEND_END_ARG_INFO ()
2528
+
2525
2529
ZEND_BEGIN_ARG_INFO (arginfo_is_null , 0 )
2526
2530
ZEND_ARG_INFO (0 , var )
2527
2531
ZEND_END_ARG_INFO ()
@@ -3045,6 +3049,7 @@ const zend_function_entry basic_functions[] = { /* {{{ */
3045
3049
PHP_FE (floatval , arginfo_floatval )
3046
3050
PHP_FALIAS (doubleval , floatval , arginfo_floatval )
3047
3051
PHP_FE (strval , arginfo_strval )
3052
+ PHP_FE (boolval , arginfo_boolval )
3048
3053
PHP_FE (gettype , arginfo_gettype )
3049
3054
PHP_FE (settype , arginfo_settype )
3050
3055
PHP_FE (is_null , arginfo_is_null )
Original file line number Diff line number Diff line change 24
24
PHP_FUNCTION (intval );
25
25
PHP_FUNCTION (floatval );
26
26
PHP_FUNCTION (strval );
27
+ PHP_FUNCTION (boolval );
27
28
PHP_FUNCTION (gettype );
28
29
PHP_FUNCTION (settype );
29
30
PHP_FUNCTION (is_null );
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Testing boolval()
3
+ --FILE--
4
+ <?php
5
+ var_dump (boolval (false ));
6
+ var_dump (boolval (NULL ));
7
+ var_dump (boolval ("" ));
8
+ var_dump (boolval (0 ));
9
+ var_dump (boolval (array ()));
10
+
11
+ var_dump (boolval (true ));
12
+ var_dump (boolval ("abc " ));
13
+ var_dump (boolval (0.5 ));
14
+ var_dump (boolval (100 ));
15
+ var_dump (boolval (new stdClass ()));
16
+ var_dump (boolval (STDIN ));
17
+ ?>
18
+ --EXPECTF--
19
+ bool(false)
20
+ bool(false)
21
+ bool(false)
22
+ bool(false)
23
+ bool(false)
24
+ bool(true)
25
+ bool(true)
26
+ bool(true)
27
+ bool(true)
28
+ bool(true)
29
+ bool(true)
Original file line number Diff line number Diff line change @@ -176,6 +176,21 @@ PHP_FUNCTION(floatval)
176
176
}
177
177
/* }}} */
178
178
179
+ /* {{{ proto bool boolval(mixed var)
180
+ Get the boolean value of a variable */
181
+ PHP_FUNCTION (boolval )
182
+ {
183
+ zval * * val ;
184
+
185
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "Z" , & val ) == FAILURE ) {
186
+ return ;
187
+ }
188
+
189
+ RETVAL_ZVAL (* val , 1 , 0 );
190
+ convert_to_boolean (return_value );
191
+ }
192
+ /* }}} */
193
+
179
194
/* {{{ proto string strval(mixed var)
180
195
Get the string value of a variable */
181
196
PHP_FUNCTION (strval )
You can’t perform that action at this time.
0 commit comments