in Technology by
What are the different types of variables present in PHP?

1 Answer

0 votes
by

There are 8 primary data types in PHP which are used to construct the variables. They are:

  • Integers: Integers are whole numbers without a floating-point. Ex: 1253.
  • Doubles: Doubles are floating-point numbers. Ex: 7.876
  • Booleans: It represents two logical states- true or false.
  • NULL: NULL is a special type that only has one value, NULL. When no value is assigned to a variable, it can be assigned with NULL.
  • Arrays: Array is a named and ordered collection of similar type of data. Ex: $colors = array("red", "yellow", "blue");
  • Strings: Strings are a sequence of characters. Ex: “Hello InterviewBit!”
  • Resources: Resources are special variables that consist of references to resources external to PHP(such as database connections).
  • Objects: An instance of classes containing data and functions. Ex: $mango = new Fruit();

Related questions

0 votes
    What are the different types of variables used in shell script?...
asked May 28, 2021 in Technology by JackTerrance
0 votes
    What are the different types of variables used in shell script?...
asked Jan 19, 2021 in Technology by JackTerrance
0 votes
    Mention the different types of variables?...
asked Jan 4, 2021 in Technology by JackTerrance
0 votes
    Tanushree has created two variables with different data types. Identify the variable name and data types for the following i ... a=4.5 Select the correct answer from above options...
asked Dec 22, 2021 in Education by JackTerrance
0 votes
    IV. Tanushree has created two variables with different data types. Identify the variable name and data types for the ... a=4.5 Select the correct answer from above options...
asked Dec 22, 2021 in Education by JackTerrance
0 votes
    What are Differences between variables and constants in PHP?...
asked Jul 13, 2021 in Technology by JackTerrance
0 votes
    So this is a zany thing that I'm attempting to do, but what I am trying to achieve is querying ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    So this is a zany thing that I'm attempting to do, but what I am trying to achieve is querying ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    What are different tables and default database present in MySQL?...
asked Nov 22, 2020 in Technology by JackTerrance
0 votes
    What are the different environment variables in QTP?...
asked Oct 19, 2020 in Technology by JackTerrance
+1 vote
    Can variables belonging to different scope have same name in C Programming? If so show an example ?...
asked Nov 9, 2020 in Technology by JackTerrance
0 votes
    _________ generate summary statistics of different variables in the data frame, possibly within strata. (a) rename ( ... R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    Write a JAVA program to store the marks of any 5 subjects in different variables. Calculate total and average. ... ANY INPUT METHOD Select the correct answer from above options...
asked Dec 22, 2021 in Education by JackTerrance
0 votes
    Write a JAVA program to store the marks of any 5 subjects in different variables. Calculate total and average. ... total and average. Select the correct answer from above options...
asked Nov 30, 2021 in Education by JackTerrance
0 votes
    What are the different types of Blockchain?...
asked Jan 22, 2023 in Technology by JackTerrance
...