Explain About Data Type Using PHP

Explain about data type using php - In the previous article I have discussed about variables in php, then in this article we will discuss about the type of data in php. In PHP, the variable data type is not defined by the programmer, but is automatically determined by the PHP interpreter. However, PHP supports 8 (eight) primitive data types, namely:
  1. Boolean: Boolean Data Type in PHP is the simplest data type that is only two conditions that is True atai False.
  2. Integer: An integer data type is used to store integers containing positive and negative integers or no fraction values.
  3. Float: Double Floating type is also called double, float or real is the data type used to store decimal numbers.
  4. String: The data string type is a data type consisting of a word, either a single word or a sentence.
  5. Array: The array or array data type is the data type used to overwrite a lot of data in a single variable.
  6. Object: The object data type in php is created for OOP based programming (Oriented Programming Object).
  7. Resource: Resource Data Type is so special because it can store resource, source or address.
  8. NULL: Null Data Type Is a Data Type that does not contain anything.
File Name: type.php
Description: The sample program handles some basic data types within PHP.
Here is an example of a data type program.
Type the following php code into notepad:
<?php
$number = "0411500400";
$name = 'Johans Supri';
$age = 23;
$value = 82.25;
$status = TRUE;
echo "Number : " . $number . "<br>";
echo "Name : $name<br>";
print "Age : " . $age; print "<br>";
printf ("Value : %.3f<br>", $value);
if ($status)
 echo "Status : Active";
else
 echo "Status : Not active";
?>
Explain About Data Type Using PHP

If it is saved in the htdocs folder, name it type.php
Then run the program by opening the browser then type in address bar http: //localhost/type.php then enter. Then the result will look like the following.
Explain About Data Type Using PHP
Program View

That's the article about explain about data type using php. Hopefully the article can be useful for you. Please learn and practice so you can better understand it.

Comments

  1. This is a amazing post. This article is good . For more detail in briefly click here

    HOW TO DEFINE DATA TYPE IN PHP

    ReplyDelete

Post a Comment