MemoryRefresh!

Boolean type



Questions Answers 0%

Pages   0 from 51
Questions   0 from 84

Reset



* Boolean A number converted into boolean became false if the original value is zero, and true otherwise.
<?php echo ((boolean) 0) !== TRUE; // output 1 echo ((boolean) 99) === TRUE; // output 1 A string is converted to false only if its empty or '0'. If it contains any other data (even multiple zeros) it is converted to true.
<?php echo ((boolean) '0') === FALSE; // output 1 echo ((boolean) '00') === FALSE; // output nothing * Array - Are containers of data elements * Object - Are containers of both data and code * NULL A variable is considered to be NULL if it has been assigned the special value NULL, or if it has not yet been assigned a value at all. * Converting Between Data Types PHP takes care of converting between data types transparently. However, it is still possible to force the conversion of a value to a specific type
<?php $x = 10.88; echo (int) $x; // output 10
Questions

Related pages

Basic syntax !
Numeric type !
String type !
Boolean type !
Constants definition !
Control structures !
Reference !


0% 100%
 
 
0 pages 51 pages
1) What is the output? <?php echo ((boolean) 0) !== TRUE; echo ((boolean) 99) === FALSE;





2) What is the output? <?php echo ((boolean) '0') !== FALSE; echo ((boolean) '00') === FALSE;





3) What is the output? <?php echo (boolean) "00"; echo (int) "a";





Last Review: n/a   Passed: n/a   Reviews: n/a   Next Review: n/a  


* Boolean A number converted into boolean became false if the original value is zero, and true otherwise.
<?php echo ((boolean) 0) !== TRUE; // output 1 echo ((boolean) 99) === TRUE; // output 1 A string is converted to false only if its empty or '0'. If it contains any other data (even multiple zeros) it is converted to true.
<?php echo ((boolean) '0') === FALSE; // output 1 echo ((boolean) '00') === FALSE; // output nothing * Array - Are containers of data elements * Object - Are containers of both data and code * NULL A variable is considered to be NULL if it has been assigned the special value NULL, or if it has not yet been assigned a value at all. * Converting Between Data Types PHP takes care of converting between data types transparently. However, it is still possible to force the conversion of a value to a specific type
<?php $x = 10.88; echo (int) $x; // output 10



More from Php

Basics
Variables
Operators
Function
Array
String
Streams
Uncategorized


More from Programming

Php
jQuery




Powered by minte9.com