Widget HTML Atas

Data Type on Php part 1 | itfasilkom

In php also know the various types of data such as programming languages in general. There are 3 basic types in php are: integer, real (floating point), and string.
Php generally have 8 types of data:
  1. Integer
  2. Floating point
  3. String
  4. Array
  5. Objects
  6. Resource
  7. NULL
  8. Boolean

Integer
Integer data types include all integers, a large range of data php equal to range of data on the program language 'C' of about -2.147.483.648 to 2.147.483.647 on 32 bit platforms, and use 4 bytes of memory.
Php will convert integer to float point automatically if it is outside the range, integer can be expressed in decimal, octal, and hexadecimal form.

Example program:
<html>
<head>
<title>Data Type Integer</title>
</head>
<body>
Example Data Type With PHP:<br>
<p>
<?php
$num="123.400";
echo("Numbers that are used : $num<br> \n");
//data type integer
echo("Data Type Integer : $num<br> \n");


//data type string
settype($num,"String");
echo("Data Type String : $num<br> \n");


//data type double
settype($num,"Double");
echo("Data Type Double : $num<br> \n");
?>
</p>
</body>
</html>

Floating Point
Floating point (floats, double, and real) is a representation of decimal numbers. Range data type floating point equal to range data type double on 'C' language program : 1.7E308 to -1.7E308
Floating point or real can be expressed as follows:

  • $a = 1.234;
  • $a = 1.2e3;
  • $a = 7E-10;
Boolean
In the data type boolean has only a value of true and false. Keyword true and false non-case sensitive.
There are some conditions in a boolean value that should be used, namely:
  1. For integer and floating point, a boolean value is false if the value is 0, and the other is true
  2. For Variables that have not been created / defined values are false. For the type of data object, false if no variable / function defined in it, otherwise it is true.
  3. For string, false if it is empty ("")
  4. The array data type, if the element is empty then it is false, otherwise true

No comments for "Data Type on Php part 1 | itfasilkom"

Search Results Computer Programing, technological, Data Appears, RiskTool, games, memory, MIPS Computer Programing, technological, Data Appears, RiskTool, games, memory, MIPS