Sunday 11 February 2018

PHP Data Types

Data types are used to store different values in the variable
PHP supports the following data types:
  • String(e.g "dev",'dev','ram',"dipak")
  • Integer(e.g. 1,2,3,4,5……)
  • Float (floating point numbers - also called double)(e.g. 1.23,3.45.8.9)
  • Boolean
  • Array
  • Object
  • NULL
  • Resource
Comments
Comments are not executed by compiler.
Comments are used to highlight the statements.
You can explain code, variable, method, object, property or class but not execute the code.
There are two types of comments in PHP.
·                     Single Line comment (//)
·                     Multi Line comment (/ ..... /).


Print Statement:
In php there are two ways to get your output that is echo and print.
Echo Example:
Example 1:
    <?php
   echo "<h1>PHP Example</h1>";
    ?>
  Output:
 PHP Example
Example 2:
 <?php
    $name="Welcome to LearningPoint92";
    echo "<h4>Heyyy:$name</h4>";
    ?>
 Output:
Heyyy: Welcome to LearningPoint92


print Example:
Example 3:
 <?php
 $name="Welcome to LearningPoint92";
 print "<h4>Heyyy:$name</h4>";
 ?>
Output:
Heyyy: Welcome to LearningPoint92


No comments:

Post a Comment

apply function in R

1) apply function: It takes 3 arguments matrix,margin and function.. Example: m<-matrix(c(1,2,3,4),nrow=2,ncol=2) m #1 indicates it is ap...